Skip to content

Commit

Permalink
refactor: Add example of project with resource (#346)
Browse files Browse the repository at this point in the history
This just adds the most minimal terraform script to provision a resource (the [`null_resource`](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource)) that doesn't require a cloud provider.

With this, we can test creating projects that have an associated resource:
<img width="464" alt="Screen Shot 2022-02-21 at 2 31 54 PM" src="https://user-images.githubusercontent.com/88213859/155033757-372cafbf-b35f-4988-8fbe-af276e22421c.png">
  • Loading branch information
bryphe-coder committed Feb 23, 2022
1 parent 1789ba0 commit 2e12cb9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions examples/project-with-resource/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# For interesting types of variables, check out the terraform docs:
# https://www.terraform.io/language/values/variables#declaring-an-input-variable
variable "message" {
type = string
}

# We can use a "null_resource" to test resources without a cloud provider:
# https://www.terraform.io/language/resources/provisioners/null_resource
resource "null_resource" "minimal_resource" {

# Note that Terraform's `provisioner` concept is generally an anti-pattern -
# more info here: https://www.terraform.io/language/resources/provisioners/syntax
# But it's helpful here for testing a resource.
provisioner "local-exec" {
command = "echo ${var.message}"
}
}

0 comments on commit 2e12cb9

Please sign in to comment.