Skip to content

Commit

Permalink
r/aws_lightsail_instance: Fix crash when encountering key-only tags. …
Browse files Browse the repository at this point in the history
…Creating tags with an empty string as a value appears to correctly create these key-only tags.
  • Loading branch information
stefansundin committed Mar 11, 2020
1 parent 4692793 commit 8129b77
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 7 additions & 1 deletion aws/internal/keyvaluetags/service_tags_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions aws/resource_aws_lightsail_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func TestAccAWSLightsailInstance_Tags(t *testing.T) {
resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "blueprint_id"),
resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "bundle_id"),
resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "key_pair_name"),
resource.TestCheckResourceAttr("aws_lightsail_instance.lightsail_instance_test", "tags.%", "1"),
resource.TestCheckResourceAttr("aws_lightsail_instance.lightsail_instance_test", "tags.%", "2"),
),
},
{
Expand All @@ -171,7 +171,7 @@ func TestAccAWSLightsailInstance_Tags(t *testing.T) {
resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "blueprint_id"),
resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "bundle_id"),
resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "key_pair_name"),
resource.TestCheckResourceAttr("aws_lightsail_instance.lightsail_instance_test", "tags.%", "2"),
resource.TestCheckResourceAttr("aws_lightsail_instance.lightsail_instance_test", "tags.%", "3"),
),
},
},
Expand Down Expand Up @@ -320,6 +320,7 @@ resource "aws_lightsail_instance" "lightsail_instance_test" {
bundle_id = "nano_1_0"
tags = {
Name = "tf-test"
KeyOnlyTag = ""
}
}
`, lightsailName)
Expand All @@ -338,6 +339,7 @@ resource "aws_lightsail_instance" "lightsail_instance_test" {
bundle_id = "nano_1_0"
tags = {
Name = "tf-test",
KeyOnlyTag = ""
ExtraName = "tf-test"
}
}
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/lightsail_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ instance (see list below)
* `key_pair_name` - (Optional) The name of your key pair. Created in the
Lightsail console (cannot use `aws_key_pair` at this time)
* `user_data` - (Optional) launch script to configure server with additional user data
* `tags` - (Optional) A mapping of tags to assign to the resource.
* `tags` - (Optional) A mapping of tags to assign to the resource. To create key-only tags, use an empty string as a value.

## Availability Zones
Lightsail currently supports the following Availability Zones (e.g. `us-east-1a`):
Expand Down

0 comments on commit 8129b77

Please sign in to comment.