Skip to content

Commit

Permalink
Merge pull request #7697 from terraform-providers/td-aws_region-remov…
Browse files Browse the repository at this point in the history
…e-deprecated

data-source/aws_region: Remove deprecated current attribute
  • Loading branch information
bflad authored Feb 27, 2019
2 parents 099d035 + d3a627a commit 56ef797
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
9 changes: 4 additions & 5 deletions aws/data_source_aws_region.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ func dataSourceAwsRegion() *schema.Resource {
},

"current": {
Type: schema.TypeBool,
Optional: true,
Computed: true,
Deprecated: "Defaults to current provider region if no other filtering is enabled",
Type: schema.TypeBool,
Optional: true,
Computed: true,
Removed: "Defaults to current provider region if no other filtering is enabled",
},

"endpoint": {
Expand Down Expand Up @@ -76,7 +76,6 @@ func dataSourceAwsRegionRead(d *schema.ResourceData, meta interface{}) error {
}

d.SetId(region.ID())
d.Set("current", region.ID() == providerRegion)

regionEndpointEc2, err := region.ResolveEndpoint(endpoints.Ec2ServiceID)
if err != nil {
Expand Down
8 changes: 0 additions & 8 deletions aws/data_source_aws_region_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ func TestAccDataSourceAwsRegion_basic(t *testing.T) {
Config: testAccDataSourceAwsRegionConfig_empty,
Check: resource.ComposeTestCheckFunc(
testAccDataSourceAwsRegionCheck(resourceName),
resource.TestCheckResourceAttr(resourceName, "current", "true"),
resource.TestCheckResourceAttr(resourceName, "endpoint", "ec2.us-east-1.amazonaws.com"),
resource.TestCheckResourceAttr(resourceName, "name", "us-east-1"),
resource.TestCheckResourceAttr(resourceName, "description", "US East (N. Virginia)"),
Expand Down Expand Up @@ -122,7 +121,6 @@ func TestAccDataSourceAwsRegion_endpoint(t *testing.T) {
Config: testAccDataSourceAwsRegionConfig_endpoint(endpoint1),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceAwsRegionCheck(resourceName),
resource.TestCheckResourceAttr(resourceName, "current", "true"),
resource.TestCheckResourceAttr(resourceName, "endpoint", endpoint1),
resource.TestCheckResourceAttr(resourceName, "name", name1),
resource.TestCheckResourceAttr(resourceName, "description", description1),
Expand All @@ -132,7 +130,6 @@ func TestAccDataSourceAwsRegion_endpoint(t *testing.T) {
Config: testAccDataSourceAwsRegionConfig_endpoint(endpoint2),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceAwsRegionCheck(resourceName),
resource.TestCheckResourceAttr(resourceName, "current", "false"),
resource.TestCheckResourceAttr(resourceName, "endpoint", endpoint2),
resource.TestCheckResourceAttr(resourceName, "name", name2),
resource.TestCheckResourceAttr(resourceName, "description", description2),
Expand Down Expand Up @@ -168,7 +165,6 @@ func TestAccDataSourceAwsRegion_endpointAndName(t *testing.T) {
Config: testAccDataSourceAwsRegionConfig_endpointAndName(endpoint1, name1),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceAwsRegionCheck(resourceName),
resource.TestCheckResourceAttr(resourceName, "current", "true"),
resource.TestCheckResourceAttr(resourceName, "endpoint", endpoint1),
resource.TestCheckResourceAttr(resourceName, "name", name1),
resource.TestCheckResourceAttr(resourceName, "description", description1),
Expand All @@ -178,7 +174,6 @@ func TestAccDataSourceAwsRegion_endpointAndName(t *testing.T) {
Config: testAccDataSourceAwsRegionConfig_endpointAndName(endpoint2, name2),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceAwsRegionCheck(resourceName),
resource.TestCheckResourceAttr(resourceName, "current", "false"),
resource.TestCheckResourceAttr(resourceName, "endpoint", endpoint2),
resource.TestCheckResourceAttr(resourceName, "name", name2),
resource.TestCheckResourceAttr(resourceName, "description", description2),
Expand All @@ -188,7 +183,6 @@ func TestAccDataSourceAwsRegion_endpointAndName(t *testing.T) {
Config: testAccDataSourceAwsRegionConfig_endpointAndName(endpoint1, name1),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceAwsRegionCheck(resourceName),
resource.TestCheckResourceAttr(resourceName, "current", "true"),
resource.TestCheckResourceAttr(resourceName, "endpoint", endpoint1),
resource.TestCheckResourceAttr(resourceName, "name", name1),
resource.TestCheckResourceAttr(resourceName, "description", description1),
Expand Down Expand Up @@ -228,7 +222,6 @@ func TestAccDataSourceAwsRegion_name(t *testing.T) {
Config: testAccDataSourceAwsRegionConfig_name(name1),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceAwsRegionCheck(resourceName),
resource.TestCheckResourceAttr(resourceName, "current", "true"),
resource.TestCheckResourceAttr(resourceName, "endpoint", endpoint1),
resource.TestCheckResourceAttr(resourceName, "name", name1),
resource.TestCheckResourceAttr(resourceName, "description", description1),
Expand All @@ -238,7 +231,6 @@ func TestAccDataSourceAwsRegion_name(t *testing.T) {
Config: testAccDataSourceAwsRegionConfig_name(name2),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceAwsRegionCheck(resourceName),
resource.TestCheckResourceAttr(resourceName, "current", "false"),
resource.TestCheckResourceAttr(resourceName, "endpoint", endpoint2),
resource.TestCheckResourceAttr(resourceName, "name", name2),
resource.TestCheckResourceAttr(resourceName, "description", description2),
Expand Down
3 changes: 0 additions & 3 deletions website/docs/d/region.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ In addition to all arguments above, the following attributes are exported:

* `name` - The name of the selected region.

* `current` - `true` if the selected region is the one configured on the
provider, or `false` otherwise.

* `endpoint` - The EC2 endpoint for the selected region.

* `description` - The region's description in this format: "Location (Region name)".

0 comments on commit 56ef797

Please sign in to comment.