Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support tags for aws_db_subnet_group #3138

Merged
merged 3 commits into from
Oct 15, 2015
Merged

Support tags for aws_db_subnet_group #3138

merged 3 commits into from
Oct 15, 2015

Conversation

mastor
Copy link
Contributor

@mastor mastor commented Sep 1, 2015

Tags support was missing from the aws_db_subnet_group.

Disclaimer: First time I've "written" something in go, inspired by resource_aws_db_instance.go

@apparentlymart
Copy link
Contributor

Welcome to Go and Terraform!

When I ran the acceptance tests for this I got this failure:

--- FAIL: TestAccAWSDBSubnetGroup_basic (8.21s)
        testing.go:136: Step 0 error: After applying this step, the plan was not empty:

                DIFF:

                UPDATE: aws_db_subnet_group.foo
                  tags.#:    "0" => "1"
                  tags.Name: "" => "tf-dbsubnet-group-test"

                STATE:

                aws_db_subnet_group.foo:
                  ID = FOO
                  description = foo description
                  name = FOO
                  subnet_ids.# = 2
                  subnet_ids.3694747663 = subnet-ba4609df
                  subnet_ids.661001544 = subnet-cd167bba
                  tags.# = 0

                  Dependencies:
                    aws_subnet.foo
                    aws_subnet.bar
                aws_subnet.bar:
                  ID = subnet-ba4609df
                  availability_zone = us-west-2b
                  cidr_block = 10.1.2.0/24
                  map_public_ip_on_launch = false
                  tags.# = 1
                  tags.Name = tf-dbsubnet-test-2
                  vpc_id = vpc-d35529b6

                  Dependencies:
                    aws_vpc.foo
                aws_subnet.foo:
                  ID = subnet-cd167bba
                  availability_zone = us-west-2a
                  cidr_block = 10.1.1.0/24
                  map_public_ip_on_launch = false
                  tags.# = 1
                  tags.Name = tf-dbsubnet-test-1
                  vpc_id = vpc-d35529b6

                  Dependencies:
                    aws_vpc.foo
                aws_vpc.foo:
                  ID = vpc-d35529b6
                  cidr_block = 10.1.0.0/16
                  default_network_acl_id = acl-365c2153
                  default_security_group_id = sg-0e0bb76a
                  dhcp_options_id = dopt-d67b95b3
                  main_route_table_id = rtb-05692d60
                  tags.# = 0

This error means that after the first apply step (which would run Create) there was still a diff between the state and the configuration. Based on the rest of the output, the tags are not reflected in the state.

It looks like the Read function (which is being called at the end of Create before returning) is failing to look up the tags. I think the issue is that you re-used the ARN-building function from aws_db_instance and so it's building a DB instance ARN rather than a subnet group ARN. I tried making a new function with subgrp in the ARN instead of db, and that seems to have done the trick; the acceptance tests are now passing.

Aside from this little bug, this looks good to me!

@mastor
Copy link
Contributor Author

mastor commented Sep 2, 2015

Thanks @apparentlymart !

I run make testacc TEST=./builtin/providers/aws TESTARGS='-run=SubnetGroup' myself this time before pushing...

@stack72
Copy link
Contributor

stack72 commented Oct 14, 2015

@apparentlymart I have just tested this and got the following

make testacc TEST=./builtin/providers/aws TESTARGS='-run=SubnetGroup' 2>~/tf.log
go generate ./...
TF_ACC=1 go test ./builtin/providers/aws -v -run=SubnetGroup -timeout 90m
=== RUN   TestAccAWSDBSubnetGroup_basic
--- PASS: TestAccAWSDBSubnetGroup_basic (16.16s)
=== RUN   TestAccAWSDBSubnetGroup_withUndocumentedCharacters
--- PASS: TestAccAWSDBSubnetGroup_withUndocumentedCharacters (13.87s)
=== RUN   TestAccAWSElasticacheSubnetGroup_basic
--- PASS: TestAccAWSElasticacheSubnetGroup_basic (11.84s)
=== RUN   TestAccAWSElasticacheSubnetGroup_update
--- PASS: TestAccAWSElasticacheSubnetGroup_update (18.70s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    60.592s

I think this looks good to merge :)

@apparentlymart
Copy link
Contributor

Awesome! Thanks @mastor and thanks @stack72 for the review and test. 😁

🚢 🚢 🚢 🚢

apparentlymart added a commit that referenced this pull request Oct 15, 2015
Support tags for aws_db_subnet_group
@apparentlymart apparentlymart merged commit 3708e75 into hashicorp:master Oct 15, 2015
@apparentlymart
Copy link
Contributor

Merging this resulted in a failed build but it appears to be caused by Azure/azure-sdk-for-go#225 rather than anything in this changeset.

@ghost
Copy link

ghost commented Apr 30, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants