generated from billgrant/terraform-aws-s3-pov
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d696e63
Showing
8 changed files
with
153 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
.DS_Store | ||
|
||
# Local .terraform directories | ||
**/.terraform/* | ||
|
||
# .tfstate files | ||
*.tfstate | ||
*.tfstate.* | ||
|
||
# Crash log files | ||
crash.log | ||
crash.*.log | ||
|
||
# Exclude all .tfvars files, which are likely to contain sensitive data, such as | ||
# password, private keys, and other secrets. These should not be part of version | ||
# control as they are data points which are potentially sensitive and subject | ||
# to change depending on the environment. | ||
*.tfvars | ||
*.tfvars.json | ||
|
||
# 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* | ||
|
||
# Ignore CLI configuration files | ||
.terraformrc | ||
terraform.rc | ||
|
||
# ignore lock files | ||
*.lock.hcl | ||
|
||
|
||
# ingore backend file | ||
backend.tf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# terraform-aws-s3-test | ||
|
||
S3 bucket code for proof of concepts in Terraform cloud. | ||
|
||
## Instructions | ||
|
||
* Rename `terraform.auto.tfvars.example` to `terraform.auto.tfvars` and fill in the values. | ||
* Fill in your Organization name and your workspace name in the `main.tf` file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
terraform { | ||
# cloud { | ||
# # Change this to your organization name | ||
# organization = "billgrant" | ||
|
||
# workspaces { | ||
# # change this to your workspace name | ||
# name = "ravi-cli" | ||
# } | ||
# } | ||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
} | ||
} | ||
} | ||
|
||
provider "aws" { | ||
region = var.aws_region | ||
} | ||
|
||
resource "aws_s3_bucket" "example" { | ||
tags = { | ||
Name = var.name | ||
Environment = var.environment | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
output "bucket_id" { | ||
value = aws_s3_bucket.example.id | ||
description = "The ID of the S3 bucket" | ||
} | ||
|
||
output "bucket_arn" { | ||
value = aws_s3_bucket.example.arn | ||
description = "The ARN of the S3 bucket" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Rename this file to terraform.auto.tfvars and fill in the values. | ||
name = "name-tag" | ||
environment = "environment-tag" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# WARNING: Generated module tests should be considered experimental and be reviewed by the module author. | ||
|
||
variables { | ||
aws_region = "us-east-1" | ||
name = "test-bucket" | ||
environment = "test-env" | ||
} | ||
|
||
run "resource_validation" { | ||
assert { | ||
condition = aws_s3_bucket.example.tags.Name == "test-bucket" | ||
error_message = "incorrect bucket name" | ||
} | ||
|
||
assert { | ||
condition = aws_s3_bucket.example.tags.Environment == "test-env" | ||
error_message = "incorrect environment" | ||
} | ||
} | ||
|
||
run "variables_validation" { | ||
assert { | ||
condition = var.aws_region == "us-east-1" | ||
error_message = "incorrect AWS region" | ||
} | ||
|
||
assert { | ||
condition = var.name == "test-bucket" | ||
error_message = "incorrect bucket name" | ||
} | ||
|
||
assert { | ||
condition = var.environment == "test-env" | ||
error_message = "incorrect environment" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# WARNING: Generated module tests should be considered experimental and be reviewed by the module author. | ||
|
||
run "outputs_validation" { | ||
assert { | ||
condition = output.bucket_id != "" | ||
error_message = "bucket_id should not be empty" | ||
} | ||
|
||
assert { | ||
condition = output.bucket_arn != "" | ||
error_message = "bucket_arn should not be empty" | ||
} | ||
} | ||
|
||
# Please note that these tests are generated and should be reviewed by the module author to ensure they are testing the correct conditions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
variable "aws_region" { | ||
default = "us-east-1" | ||
description = "AWS region to deploy resources." | ||
} | ||
|
||
variable "name" { | ||
description = "Name of the S3 bucket." | ||
} | ||
|
||
variable "environment" { | ||
description = "Environment to deploy resources." | ||
} |