Skip to content

Commit b378217

Browse files
committed
Update code after edit pass
1 parent a4c0d5a commit b378217

File tree

46 files changed

+192
-130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+192
-130
lines changed
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# OPA example
22

33
This folder contains example [Open Policy Agent (OPA)](https://www.openpolicyagent.org/) policy that enforces all
4-
module source URLs come from the `brikis98` GitHub org.
4+
resources include a specific tag.
55

66
For more info, please see Chapter 9, "How to test Terraform code", of
77
*[Terraform: Up and Running](http://www.terraformupandrunning.com)*.
88

99
## Quick start
1010

11-
The best way to run this test is with Terratest. See
12-
[opa_test.go](../../terraform/09-testing-terraform-code/test/opa_test.go).
11+
Please see the README in the companion Terraform module at
12+
[09-testing-terraform-code/examples/opa](../../terraform/09-testing-terraform-code/examples/opa) for instructions on
13+
how to use this policy to test that module.
1314

code/opa/09-testing-terraform-code/enforce_source.rego

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package tuar
2+
3+
allow {
4+
resource_change := input.resource_changes[_]
5+
resource_change.change.after.tags["ManagedBy"]
6+
}

code/packer/01-why-terraform/webserver.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"builders": [{
3-
"ami_name": "packer-example",
3+
"ami_name": "packer-example-{{isotime | clean_resource_name}}",
44
"instance_type": "t2.micro",
55
"region": "us-east-2",
66
"type": "amazon-ebs",
@@ -16,6 +16,7 @@
1616
],
1717
"environment_vars": [
1818
"DEBIAN_FRONTEND=noninteractive"
19-
]
19+
],
20+
"pause_before": "60s"
2021
}]
2122
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
# Define the function in one place
12
def example_function()
23
puts "Hello, World"
34
end
45

5-
# Other places in your code
6+
# Use the function in multiple other places
67
example_function()
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
# A function that returns a value
12
def example_function(param1, param2)
23
return "Hello, #{param1} #{param2}"
34
end
45

5-
# Other places in your code
6+
# Call the function and get the return value
67
return_value = example_function("foo", "bar")
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
# A function with two input parameters
12
def example_function(param1, param2)
23
puts "Hello, #{param1} #{param2}"
34
end
45

5-
# Other places in your code
6+
# Pass two input parameters to the function
67
example_function("foo", "bar")

code/terraform/02-intro-to-terraform-syntax/webserver-cluster/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ resource "aws_launch_configuration" "example" {
2525
EOF
2626

2727
# Required when using a launch configuration with an auto scaling group.
28-
# https://www.terraform.io/docs/providers/aws/r/launch_configuration.html
2928
lifecycle {
3029
create_before_destroy = true
3130
}

code/terraform/03-terraform-state/file-layout-example/global/s3/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ resource "aws_s3_bucket" "terraform_state" {
2323

2424
}
2525

26-
# Enable versioning so you can see the full revision history of our
26+
# Enable versioning so you can see the full revision history of your
2727
# state files
2828
resource "aws_s3_bucket_versioning" "enabled" {
2929
bucket = aws_s3_bucket.terraform_state.id
@@ -38,7 +38,7 @@ resource "aws_s3_bucket_server_side_encryption_configuration" "default" {
3838

3939
rule {
4040
apply_server_side_encryption_by_default {
41-
sse_algorithm = "AES256"
41+
sse_algorithm = "AES256"
4242
}
4343
}
4444
}

code/terraform/03-terraform-state/file-layout-example/stage/data-stores/mysql/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ resource "aws_db_instance" "example" {
3131
engine = "mysql"
3232
allocated_storage = 10
3333
instance_class = "db.t2.micro"
34+
skip_final_snapshot = true
3435

3536
db_name = var.db_name
36-
skip_final_snapshot = true
3737

3838
username = var.db_username
3939
password = var.db_password

0 commit comments

Comments
 (0)