Skip to content

Commit

Permalink
Merge pull request #107 from terraform-providers/fix-peering
Browse files Browse the repository at this point in the history
Fix peering resource
  • Loading branch information
PacoDw committed Jan 17, 2020
2 parents 98b6f69 + 66e0168 commit 3719fe5
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 93 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/go-test/deep v1.0.1
github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce // indirect
github.com/hashicorp/terraform v0.12.1
github.com/mongodb/go-client-mongodb-atlas v0.1.3-0.20200110215223-d0530efb030d
github.com/mongodb/go-client-mongodb-atlas v0.1.3-0.20200116162614-e6f2e30401ac
github.com/mwielbut/pointy v1.1.0
github.com/spf13/cast v1.3.0
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ github.com/mitchellh/prefixedio v0.0.0-20190213213902-5733675afd51 h1:eD92Am0Qf3
github.com/mitchellh/prefixedio v0.0.0-20190213213902-5733675afd51/go.mod h1:kB1naBgV9ORnkiTVeyJOI1DavaJkG4oNIq0Af6ZVKUo=
github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY=
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/mongodb/go-client-mongodb-atlas v0.1.3-0.20200110215223-d0530efb030d h1:M+jxUj2Q20KeXstXElNlbpxg7QVx4ZR1o9vHDS3HEqo=
github.com/mongodb/go-client-mongodb-atlas v0.1.3-0.20200110215223-d0530efb030d/go.mod h1:LS8O0YLkA+sbtOb3fZLF10yY3tJM+1xATXMJ3oU35LU=
github.com/mongodb/go-client-mongodb-atlas v0.1.3-0.20200116162614-e6f2e30401ac h1:sCeiLQ1of3mhZqBp5BFcdUwfl5WPCdww/78ZmXJRh+M=
github.com/mongodb/go-client-mongodb-atlas v0.1.3-0.20200116162614-e6f2e30401ac/go.mod h1:LS8O0YLkA+sbtOb3fZLF10yY3tJM+1xATXMJ3oU35LU=
github.com/mwielbut/pointy v1.1.0 h1:U5/YEfoIkaGCHv0St3CgjduqXID4FNRoyZgLM1kY9vg=
github.com/mwielbut/pointy v1.1.0/go.mod h1:MvvO+uMFj9T5DMda33HlvogsFBX7pWWKAkFIn4teYwY=
github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo=
Expand Down
4 changes: 2 additions & 2 deletions mongodbatlas/data_source_mongodbatlas_network_peering.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func dataSourceMongoDBAtlasNetworkPeeringRead(d *schema.ResourceData, meta inter
}
}

if err := d.Set("aws_account_id", peer.AWSAccountId); err != nil {
if err := d.Set("aws_account_id", peer.AWSAccountID); err != nil {
return fmt.Errorf("error setting `aws_account_id` for Network Peering Connection (%s): %s", peerID, err)
}

Expand Down Expand Up @@ -169,7 +169,7 @@ func dataSourceMongoDBAtlasNetworkPeeringRead(d *schema.ResourceData, meta inter
return fmt.Errorf("error setting `azure_directory_id` for Network Peering Connection (%s): %s", peerID, err)
}

if err := d.Set("azure_subscription_id", peer.AzureSubscriptionId); err != nil {
if err := d.Set("azure_subscription_id", peer.AzureSubscriptionID); err != nil {
return fmt.Errorf("error setting `azure_subscription_id` for Network Peering Connection (%s): %s", peerID, err)
}

Expand Down
4 changes: 2 additions & 2 deletions mongodbatlas/data_source_mongodbatlas_network_peerings.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func flattenNetworkPeerings(peers []matlas.Peer) []map[string]interface{} {
"peering_id": peer.ID,
"container_id": peer.ContainerID,
"accepter_region_name": peer.AccepterRegionName,
"aws_account_id": peer.AWSAccountId,
"aws_account_id": peer.AWSAccountID,
"provider_name": getProviderNameByPeer(peer),
"route_table_cidr_block": peer.RouteTableCIDRBlock,
"vpc_id": peer.VpcID,
Expand All @@ -151,7 +151,7 @@ func flattenNetworkPeerings(peers []matlas.Peer) []map[string]interface{} {
"status_name": peer.StatusName,
"atlas_cidr_block": peer.AtlasCIDRBlock,
"azure_directory_id": peer.AzureDirectoryID,
"azure_subscription_id": peer.AzureSubscriptionId,
"azure_subscription_id": peer.AzureSubscriptionID,
"resource_group_name": peer.ResourceGroupName,
"vnet_name": peer.VNetName,
"error_state": peer.ErrorState,
Expand Down
12 changes: 6 additions & 6 deletions mongodbatlas/resource_mongodbatlas_network_peering.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func resourceMongoDBAtlasNetworkPeeringCreate(d *schema.ResourceData, meta inter
}

peerRequest.AccepterRegionName = region
peerRequest.AWSAccountId = awsAccountID.(string)
peerRequest.AWSAccountID = awsAccountID.(string)
peerRequest.RouteTableCIDRBlock = rtCIDR.(string)
peerRequest.VpcID = vpcID.(string)

Expand Down Expand Up @@ -237,7 +237,7 @@ func resourceMongoDBAtlasNetworkPeeringCreate(d *schema.ResourceData, meta inter

peerRequest.AtlasCIDRBlock = atlasCidrBlock.(string)
peerRequest.AzureDirectoryID = azureDirectoryID.(string)
peerRequest.AzureSubscriptionId = azureSubscriptionID.(string)
peerRequest.AzureSubscriptionID = azureSubscriptionID.(string)
peerRequest.ResourceGroupName = resourceGroupName.(string)
peerRequest.VNetName = vnetName.(string)

Expand Down Expand Up @@ -296,7 +296,7 @@ func resourceMongoDBAtlasNetworkPeeringRead(d *schema.ResourceData, meta interfa
}
}

if err := d.Set("aws_account_id", peer.AWSAccountId); err != nil {
if err := d.Set("aws_account_id", peer.AWSAccountID); err != nil {
return fmt.Errorf("error setting `aws_account_id` for Network Peering Connection (%s): %s", peerID, err)
}

Expand All @@ -321,7 +321,7 @@ func resourceMongoDBAtlasNetworkPeeringRead(d *schema.ResourceData, meta interfa
if err := d.Set("azure_directory_id", peer.AzureDirectoryID); err != nil {
return fmt.Errorf("error setting `azure_directory_id` for Network Peering Connection (%s): %s", peerID, err)
}
if err := d.Set("azure_subscription_id", peer.AzureSubscriptionId); err != nil {
if err := d.Set("azure_subscription_id", peer.AzureSubscriptionID); err != nil {
return fmt.Errorf("error setting `azure_subscription_id` for Network Peering Connection (%s): %s", peerID, err)
}
if err := d.Set("resource_group_name", peer.ResourceGroupName); err != nil {
Expand Down Expand Up @@ -383,7 +383,7 @@ func resourceMongoDBAtlasNetworkPeeringUpdate(d *schema.ResourceData, meta inter
}

if d.HasChange("aws_account_id") {
peer.AWSAccountId = d.Get("aws_account_id").(string)
peer.AWSAccountID = d.Get("aws_account_id").(string)
}

if d.HasChange("provider_name") {
Expand All @@ -403,7 +403,7 @@ func resourceMongoDBAtlasNetworkPeeringUpdate(d *schema.ResourceData, meta inter
}

if d.HasChange("azure_subscription_id") {
peer.AzureSubscriptionId = d.Get("azure_subscription_id").(string)
peer.AzureSubscriptionID = d.Get("azure_subscription_id").(string)
}

if d.HasChange("resource_group_name") {
Expand Down

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

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

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

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

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

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

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ github.com/mitchellh/hashstructure
github.com/mitchellh/mapstructure
# github.com/mitchellh/reflectwalk v1.0.0
github.com/mitchellh/reflectwalk
# github.com/mongodb/go-client-mongodb-atlas v0.1.3-0.20200110215223-d0530efb030d
# github.com/mongodb/go-client-mongodb-atlas v0.1.3-0.20200116162614-e6f2e30401ac
github.com/mongodb/go-client-mongodb-atlas/mongodbatlas
# github.com/mwielbut/pointy v1.1.0
github.com/mwielbut/pointy
Expand Down

0 comments on commit 3719fe5

Please sign in to comment.