diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..cba1d468 --- /dev/null +++ b/.gitignore @@ -0,0 +1,30 @@ +# Local .terraform directories +**/.terraform/* + +# .tfstate files +*.tfstate +*.tfstate.* + +# Crash log files +crash.log + +# Ignore any .tfvars files that are generated automatically for each Terraform run. Most +# .tfvars files are managed as part of configuration and so should be included in +# version control. +# +# example.tfvars + +# Ignore override files as they are usually used to override resources locally and so +# are not checked in +override.tf +override.tf.json +*_override.tf +*_override.tf.json + +# Include override files you do wish to add to version control using negated pattern +# +# !example_override.tf + +# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan +# example: *tfplan* + diff --git a/README.md b/README.md new file mode 100644 index 00000000..791fcc4c --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Terraform Cloud Getting Started Guide Example + +This is an example Terraform configuration intended for use with the Terraform Cloud Getting Started Guide hosted at https://learn.hashicorp.com/terraform/cloud/tf_cloud_overview diff --git a/main.tf b/main.tf new file mode 100644 index 00000000..3ddabfb6 --- /dev/null +++ b/main.tf @@ -0,0 +1,22 @@ +provider "aws" { + version = "2.33.0" + + region = var.aws_region +} + +resource "aws_dynamodb_table" "tfc_example_table" { + name = var.db_table_name + + read_capacity = var.db_read_capacity + write_capacity = var.db_write_capacity + hash_key = "UUID" + + attribute { + name = "UUID" + type = "S" + } + + tags = { + user_name = var.tag_user_name + } +} diff --git a/outputs.tf b/outputs.tf new file mode 100644 index 00000000..d29d2f6d --- /dev/null +++ b/outputs.tf @@ -0,0 +1,3 @@ +output "tfc_example_table_arn" { + value = aws_dynamodb_table.tfc_example_table.arn +} diff --git a/variables.tf b/variables.tf new file mode 100644 index 00000000..32569bd1 --- /dev/null +++ b/variables.tf @@ -0,0 +1,23 @@ +variable "aws_region" { + type = string + default = "us-west-1" +} + +variable "db_table_name" { + type = string + default = "exampleTable" +} + +variable "db_read_capacity" { + type = number + default = 1 +} + +variable "db_write_capacity" { + type = number + default = 1 +} + +variable "tag_user_name" { + type = string +}