Skip to content

Commit

Permalink
Rename aws_tags to just tags, for uniformity with regular AWS resources.
Browse files Browse the repository at this point in the history
  • Loading branch information
jareware committed Apr 10, 2019
1 parent 4608de3 commit e2adae5
Show file tree
Hide file tree
Showing 29 changed files with 46 additions and 46 deletions.
2 changes: 1 addition & 1 deletion aws_domain_redirect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Applying this **will take a very long time**, because both ACM and especially Cl

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| aws_tags | AWS Tags to add to all resources created (where possible); see https://aws.amazon.com/answers/account-management/aws-tagging-strategies/ | map | `<map>` | no |
| tags | AWS Tags to add to all resources created (where possible); see https://aws.amazon.com/answers/account-management/aws-tagging-strategies/ | map | `<map>` | no |
| comment_prefix | This will be included in comments for resources that are created | string | `"Domain redirect: "` | no |
| lambda_logging_enabled | When `true`, writes information about incoming requests to the Lambda function's CloudWatch group | string | `"false"` | no |
| name_prefix | Name prefix to use for objects that need to be created (only lowercase alphanumeric characters and hyphens allowed, for S3 bucket name compatibility) | string | `"aws-domain-redirect---"` | no |
Expand Down
6 changes: 3 additions & 3 deletions aws_domain_redirect/main.tf
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module "aws_static_site" {
# Available inputs: https://github.com/futurice/terraform-utils/tree/master/aws_static_site#inputs
# Check for updates: https://github.com/futurice/terraform-utils/compare/v9.3...master
source = "git::ssh://[email protected]/futurice/terraform-utils.git//aws_static_site?ref=v9.3"
# Check for updates: https://github.com/futurice/terraform-utils/compare/v9.4...master
source = "git::ssh://[email protected]/futurice/terraform-utils.git//aws_static_site?ref=v9.4"

site_domain = "${var.redirect_domain}"
name_prefix = "${var.name_prefix}"
comment_prefix = "${var.comment_prefix}"
bucket_override_name = "-" # providing this ensures an S3 bucket isn't unnecessarily created, even if this isn't a valid bucket name
price_class = "${var.redirect_price_class}"
lambda_logging_enabled = "${var.lambda_logging_enabled}"
aws_tags = "${var.aws_tags}"
tags = "${var.tags}"

add_response_headers = {
"Strict-Transport-Security" = "${var.redirect_with_hsts ? "max-age=31557600; preload" : ""}"
Expand Down
2 changes: 1 addition & 1 deletion aws_domain_redirect/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ variable "lambda_logging_enabled" {
default = false
}

variable "aws_tags" {
variable "tags" {
description = "AWS Tags to add to all resources created (where possible); see https://aws.amazon.com/answers/account-management/aws-tagging-strategies/"
type = "map"
default = {}
Expand Down
2 changes: 1 addition & 1 deletion aws_ec2_ebs_docker_host/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ This should finish by giving you the `docker_tunnel_command` output. Run that in
| allow_incoming_dns | Whether to allow incoming DNS traffic on the host security group | string | `"false"` | no |
| allow_incoming_http | Whether to allow incoming HTTP traffic on the host security group | string | `"false"` | no |
| allow_incoming_https | Whether to allow incoming HTTPS traffic on the host security group | string | `"false"` | no |
| aws_tags | AWS Tags to add to all resources created (where possible); see https://aws.amazon.com/answers/account-management/aws-tagging-strategies/ | map | `<map>` | no |
| tags | AWS Tags to add to all resources created (where possible); see https://aws.amazon.com/answers/account-management/aws-tagging-strategies/ | map | `<map>` | no |
| data_volume_id | The ID of the EBS volume to mount as `/data` | string | `""` | no |
| hostname | Hostname by which this service is identified in metrics, logs etc | string | `"aws-ec2-ebs-docker-host"` | no |
| instance_ami | See https://cloud-images.ubuntu.com/locator/ec2/ for options | string | `"ami-0bdf93799014acdc4"` | no |
Expand Down
8 changes: 4 additions & 4 deletions aws_ec2_ebs_docker_host/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ resource "aws_instance" "this" {
instance_type = "${var.instance_type}"
ami = "${var.instance_ami}"
availability_zone = "${local.availability_zone}"
key_name = "${aws_key_pair.this.id}" # the name of the SSH keypair to use for provisioning
key_name = "${aws_key_pair.this.id}" # the name of the SSH keypair to use for provisioning
vpc_security_group_ids = ["${aws_security_group.this.id}"]
subnet_id = "${data.aws_subnet.this.id}"
user_data = "${sha1(local.reprovision_trigger)}" # this value isn't used by the EC2 instance, but its change will trigger re-creation of the resource
tags = "${merge(var.aws_tags, map("Name", "${var.hostname}"))}"
volume_tags = "${merge(var.aws_tags, map("Name", "${var.hostname}"))}" # give the root EBS volume a name (+ other possible tags) that makes it easier to identify as belonging to this host
user_data = "${sha1(local.reprovision_trigger)}" # this value isn't used by the EC2 instance, but its change will trigger re-creation of the resource
tags = "${merge(var.tags, map("Name", "${var.hostname}"))}"
volume_tags = "${merge(var.tags, map("Name", "${var.hostname}"))}" # give the root EBS volume a name (+ other possible tags) that makes it easier to identify as belonging to this host

root_block_device {
volume_size = "${var.root_volume_size}"
Expand Down
2 changes: 1 addition & 1 deletion aws_ec2_ebs_docker_host/security.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ resource "aws_key_pair" "this" {
# Create our default security group to access the instance, over specific protocols
resource "aws_security_group" "this" {
vpc_id = "${data.aws_vpc.this.id}"
tags = "${merge(var.aws_tags, map("Name", "${var.hostname}"))}"
tags = "${merge(var.tags, map("Name", "${var.hostname}"))}"
}

# Incoming SSH & outgoing ANY needs to be allowed for provisioning to work
Expand Down
2 changes: 1 addition & 1 deletion aws_ec2_ebs_docker_host/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ variable "allow_incoming_dns" {
default = false
}

variable "aws_tags" {
variable "tags" {
description = "AWS Tags to add to all resources created (where possible); see https://aws.amazon.com/answers/account-management/aws-tagging-strategies/"
type = "map"
default = {}
Expand Down
2 changes: 1 addition & 1 deletion aws_internet_vpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module "my_vpc" {

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| aws_tags | AWS Tags to add to all resources created (where possible); see https://aws.amazon.com/answers/account-management/aws-tagging-strategies/ | map | `<map>` | no |
| tags | AWS Tags to add to all resources created (where possible); see https://aws.amazon.com/answers/account-management/aws-tagging-strategies/ | map | `<map>` | no |
| vpc_name | Name given to the VPC; in addition to human-readability, can be used to fetch this VPC using a `aws_vpc` data block | string | `"terraform-default-vpc"` | no |

## Outputs
Expand Down
8 changes: 4 additions & 4 deletions aws_internet_vpc/main.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Create an AWS Virtual Private Cloud (VPC)
resource "aws_vpc" "this" {
cidr_block = "10.0.0.0/16"
enable_dns_hostnames = true # https://stackoverflow.com/a/33443018
tags = "${merge(var.aws_tags, map("Name", "${var.vpc_name}"))}"
enable_dns_hostnames = true # https://stackoverflow.com/a/33443018
tags = "${merge(var.tags, map("Name", "${var.vpc_name}"))}"
}

# Create an internet gateway to give our subnet access to the outside world
resource "aws_internet_gateway" "this" {
vpc_id = "${aws_vpc.this.id}"
tags = "${var.aws_tags}"
tags = "${var.tags}"
}

# Grant the VPC internet access on its main route table
Expand All @@ -24,5 +24,5 @@ resource "aws_subnet" "this" {
vpc_id = "${aws_vpc.this.id}"
cidr_block = "10.0.1.0/24"
map_public_ip_on_launch = true
tags = "${var.aws_tags}"
tags = "${var.tags}"
}
2 changes: 1 addition & 1 deletion aws_internet_vpc/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ variable "vpc_name" {
default = "terraform-default-vpc"
}

variable "aws_tags" {
variable "tags" {
description = "AWS Tags to add to all resources created (where possible); see https://aws.amazon.com/answers/account-management/aws-tagging-strategies/"
type = "map"
default = {}
Expand Down
2 changes: 1 addition & 1 deletion aws_lambda_api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ Otherwise API Gateway won't have permission to write logs to CloudWatch.
| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| api_domain | Domain on which the Lambda will be made available (e.g. `"api.example.com"`) | string | n/a | yes |
| aws_tags | AWS Tags to add to all resources created (where possible); see https://aws.amazon.com/answers/account-management/aws-tagging-strategies/ | map | `<map>` | no |
| tags | AWS Tags to add to all resources created (where possible); see https://aws.amazon.com/answers/account-management/aws-tagging-strategies/ | map | `<map>` | no |
| comment_prefix | This will be included in comments for resources that are created | string | `"Lambda API: "` | no |
| function_env_vars | Which env vars (if any) to invoke the Lambda with | map | `<map>` | no |
| function_handler | Instructs Lambda on which function to invoke within the ZIP file | string | `"index.handler"` | no |
Expand Down
2 changes: 1 addition & 1 deletion aws_lambda_api/api_gateway.tf
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ resource "aws_api_gateway_stage" "this" {
description = "${var.comment_prefix}${var.api_domain}"
rest_api_id = "${aws_api_gateway_rest_api.this.id}"
deployment_id = "${aws_api_gateway_deployment.this.id}"
tags = "${var.aws_tags}"
tags = "${var.tags}"
}

resource "aws_api_gateway_method_settings" "this" {
Expand Down
6 changes: 3 additions & 3 deletions aws_lambda_api/certificate.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Generate a certificate for the domain automatically using ACM
# https://www.terraform.io/docs/providers/aws/r/acm_certificate.html
resource "aws_acm_certificate" "this" {
provider = "aws.us_east_1" # because ACM is only available in the "us-east-1" region
provider = "aws.us_east_1" # because ACM is only available in the "us-east-1" region
domain_name = "${var.api_domain}"
validation_method = "DNS" # the required records are created below
tags = "${merge(var.aws_tags, map("Name", "${var.comment_prefix}${var.api_domain}"))}"
validation_method = "DNS" # the required records are created below
tags = "${merge(var.tags, map("Name", "${var.comment_prefix}${var.api_domain}"))}"
}

# Add the DNS records needed by the ACM validation process
Expand Down
2 changes: 1 addition & 1 deletion aws_lambda_api/cloudfront.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ resource "aws_cloudfront_distribution" "this" {
aliases = ["${var.api_domain}"]
price_class = "PriceClass_${var.price_class}"
comment = "${var.comment_prefix}${var.api_domain}"
tags = "${var.aws_tags}"
tags = "${var.tags}"

# Define API Gateway as the "upstream" for the CloudFront distribution
origin {
Expand Down
4 changes: 2 additions & 2 deletions aws_lambda_api/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ resource "aws_lambda_function" "local_zipfile" {
timeout = "${var.function_timeout}"
memory_size = "${var.memory_size}"
role = "${aws_iam_role.this.arn}"
tags = "${var.aws_tags}"
tags = "${var.tags}"

environment {
variables = "${var.function_env_vars}"
Expand All @@ -41,7 +41,7 @@ resource "aws_lambda_function" "s3_zipfile" {
timeout = "${var.function_timeout}"
memory_size = "${var.memory_size}"
role = "${aws_iam_role.this.arn}"
tags = "${var.aws_tags}"
tags = "${var.tags}"

environment {
variables = "${var.function_env_vars}"
Expand Down
2 changes: 1 addition & 1 deletion aws_lambda_api/permissions.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Allow Lambda to invoke our functions:
resource "aws_iam_role" "this" {
name = "${local.prefix_with_domain}"
tags = "${var.aws_tags}"
tags = "${var.tags}"

assume_role_policy = <<EOF
{
Expand Down
2 changes: 1 addition & 1 deletion aws_lambda_api/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ variable "api_gateway_cloudwatch_metrics" {
default = false
}

variable "aws_tags" {
variable "tags" {
description = "AWS Tags to add to all resources created (where possible); see https://aws.amazon.com/answers/account-management/aws-tagging-strategies/"
type = "map"
default = {}
Expand Down
2 changes: 1 addition & 1 deletion aws_lambda_cronjob/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ As this module is a close relative of [`aws_lambda_api`](../aws_lambda_api), the

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| aws_tags | AWS Tags to add to all resources created (where possible); see https://aws.amazon.com/answers/account-management/aws-tagging-strategies/ | map | `<map>` | no |
| tags | AWS Tags to add to all resources created (where possible); see https://aws.amazon.com/answers/account-management/aws-tagging-strategies/ | map | `<map>` | no |
| comment_prefix | This will be included in comments for resources that are created | string | `"Lambda Cronjob: "` | no |
| cronjob_name | Name which will be used to create your Lambda function (e.g. `"my-important-cronjob"`) | string | n/a | yes |
| function_env_vars | Which env vars (if any) to invoke the Lambda with | map | `<map>` | no |
Expand Down
4 changes: 2 additions & 2 deletions aws_lambda_cronjob/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ resource "aws_lambda_function" "local_zipfile" {
timeout = "${var.function_timeout}"
memory_size = "${var.memory_size}"
role = "${aws_iam_role.this.arn}"
tags = "${var.aws_tags}"
tags = "${var.tags}"

environment {
variables = "${var.function_env_vars}"
Expand All @@ -37,7 +37,7 @@ resource "aws_lambda_function" "s3_zipfile" {
timeout = "${var.function_timeout}"
memory_size = "${var.memory_size}"
role = "${aws_iam_role.this.arn}"
tags = "${var.aws_tags}"
tags = "${var.tags}"

environment {
variables = "${var.function_env_vars}"
Expand Down
4 changes: 2 additions & 2 deletions aws_lambda_cronjob/permissions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

resource "aws_iam_role" "this" {
name = "${local.prefix_with_name}"
tags = "${var.aws_tags}"
tags = "${var.tags}"

assume_role_policy = <<EOF
{
Expand Down Expand Up @@ -57,7 +57,7 @@ resource "aws_iam_role_policy_attachment" "this" {
resource "aws_cloudwatch_event_rule" "this" {
name = "${local.prefix_with_name}---scheduled-invocation"
schedule_expression = "${var.schedule_expression}"
tags = "${var.aws_tags}"
tags = "${var.tags}"
}

resource "aws_cloudwatch_event_target" "this" {
Expand Down
2 changes: 1 addition & 1 deletion aws_lambda_cronjob/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ variable "lambda_logging_enabled" {
default = false
}

variable "aws_tags" {
variable "tags" {
description = "AWS Tags to add to all resources created (where possible); see https://aws.amazon.com/answers/account-management/aws-tagging-strategies/"
type = "map"
default = {}
Expand Down
2 changes: 1 addition & 1 deletion aws_mailgun_domain/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ After Mailgun is happy with your DNS records, however, you should get something

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| aws_tags | AWS Tags to add to all resources created (where possible); see https://aws.amazon.com/answers/account-management/aws-tagging-strategies/ | map | `<map>` | no |
| tags | AWS Tags to add to all resources created (where possible); see https://aws.amazon.com/answers/account-management/aws-tagging-strategies/ | map | `<map>` | no |
| mail_domain | Domain which you want to use for sending/receiving email (e.g. `"example.com"`) | string | n/a | yes |
| smtp_password | Password that Mailgun will require for sending out SMPT mail via this domain | string | n/a | yes |
| spam_action | See https://www.terraform.io/docs/providers/mailgun/r/domain.html#spam_action | string | `"disabled"` | no |
Expand Down
2 changes: 1 addition & 1 deletion aws_mailgun_domain/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ variable "wildcard" {
default = false
}

variable "aws_tags" {
variable "tags" {
description = "AWS Tags to add to all resources created (where possible); see https://aws.amazon.com/answers/account-management/aws-tagging-strategies/"
type = "map"
default = {}
Expand Down
2 changes: 1 addition & 1 deletion aws_static_site/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ Conversely, if you specify `cache_ttl_override = 300`, every object will stay in
| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| add_response_headers | Map of HTTP headers (if any) to add to outgoing responses before sending them to clients | map | `<map>` | no |
| aws_tags | AWS Tags to add to all resources created (where possible); see https://aws.amazon.com/answers/account-management/aws-tagging-strategies/ | map | `<map>` | no |
| tags | AWS Tags to add to all resources created (where possible); see https://aws.amazon.com/answers/account-management/aws-tagging-strategies/ | map | `<map>` | no |
| basic_auth_body | When using HTTP Basic Auth, and authentication has failed, this will be displayed by the browser as the page content | string | `"Unauthorized"` | no |
| basic_auth_password | When non-empty, require this password with HTTP Basic Auth | string | `""` | no |
| basic_auth_realm | When using HTTP Basic Auth, this will be displayed by the browser in the auth prompt | string | `"Authentication Required"` | no |
Expand Down
6 changes: 3 additions & 3 deletions aws_static_site/certificate.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Generate a certificate for the domain automatically using ACM
# https://www.terraform.io/docs/providers/aws/r/acm_certificate.html
resource "aws_acm_certificate" "this" {
provider = "aws.us_east_1" # because ACM is only available in the "us-east-1" region
provider = "aws.us_east_1" # because ACM is only available in the "us-east-1" region
domain_name = "${var.site_domain}"
validation_method = "DNS" # the required records are created below
tags = "${merge(var.aws_tags, map("Name", "${var.comment_prefix}${var.site_domain}"))}"
validation_method = "DNS" # the required records are created below
tags = "${merge(var.tags, map("Name", "${var.comment_prefix}${var.site_domain}"))}"
}

# Add the DNS records needed by the ACM validation process
Expand Down
2 changes: 1 addition & 1 deletion aws_static_site/cloudfront.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ resource "aws_cloudfront_distribution" "this" {
aliases = ["${var.site_domain}"]
price_class = "PriceClass_${var.price_class}"
comment = "${var.comment_prefix}${var.site_domain}"
tags = "${var.aws_tags}"
tags = "${var.tags}"

# Define the S3 bucket as the "upstream" for the CloudFront distribution
origin {
Expand Down
6 changes: 3 additions & 3 deletions aws_static_site/lambda.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ resource "aws_lambda_function" "viewer_request" {
handler = "lambda.viewer_request"
runtime = "nodejs8.10"
publish = true # because: error creating CloudFront Distribution: InvalidLambdaFunctionAssociation: The function ARN must reference a specific function version. (The ARN must end with the version number.)
tags = "${var.aws_tags}"
tags = "${var.tags}"
}

resource "aws_lambda_function" "viewer_response" {
Expand All @@ -65,13 +65,13 @@ resource "aws_lambda_function" "viewer_response" {
handler = "lambda.viewer_response"
runtime = "nodejs8.10"
publish = true # because: error creating CloudFront Distribution: InvalidLambdaFunctionAssociation: The function ARN must reference a specific function version. (The ARN must end with the version number.)
tags = "${var.aws_tags}"
tags = "${var.tags}"
}

# Allow Lambda@Edge to invoke our functions
resource "aws_iam_role" "this" {
name = "${local.prefix_with_domain}"
tags = "${var.aws_tags}"
tags = "${var.tags}"

assume_role_policy = <<EOF
{
Expand Down
2 changes: 1 addition & 1 deletion aws_static_site/s3.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ data "aws_region" "current" {}
resource "aws_s3_bucket" "this" {
count = "${var.bucket_override_name == "" ? 1 : 0}"
bucket = "${local.bucket_name}"
tags = "${var.aws_tags}"
tags = "${var.tags}"

# Add a CORS configuration, so that we don't have issues with webfont loading
# http://www.holovaty.com/writing/cors-ie-cloudfront/
Expand Down
2 changes: 1 addition & 1 deletion aws_static_site/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ variable "lambda_logging_enabled" {
default = false
}

variable "aws_tags" {
variable "tags" {
description = "AWS Tags to add to all resources created (where possible); see https://aws.amazon.com/answers/account-management/aws-tagging-strategies/"
type = "map"
default = {}
Expand Down

0 comments on commit e2adae5

Please sign in to comment.