Created
September 13, 2019 15:28
-
-
Save rch317/216993538c66c68238cb58ef36baeb94 to your computer and use it in GitHub Desktop.
TF Interview Questions
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
// This Terraform code will fail. Aside from the obvious (no provider information, etc)... | |
// Please explain why this would fail, and what you can do to fix it? | |
// Policy template to be applied to our S3 bucket. | |
data "template_file" "policy" { | |
template = file("${path.module}/policy.tpl") | |
vars = { | |
bucket_name = aws_s3_bucket.bucket.id | |
} | |
} | |
// Create an S3 bucket using a bucket_prefix so that we get a unique but predictable name. | |
resource "aws_s3_bucket" "bucket" { | |
bucket_prefix = "my-s3-bucket-" | |
// Attach our policy from above to the S3 bucket. | |
policy = data.template_file.ct_policy.rendered | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment