Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
drewmullen committed Feb 9, 2023
1 parent 7d4f177 commit 3624c2f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
4 changes: 1 addition & 3 deletions internal/service/ec2/ipam_resource_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,8 @@ func ResourceIPAMResourceDiscovery() *schema.Resource {
return nil
}
}

return fmt.Errorf("`operating_regions` must include %s", currentRegion)
}

return nil
},
),
Expand Down Expand Up @@ -198,7 +196,7 @@ func ResourceIPAMResourceDiscoveryUpdate(ctx context.Context, d *schema.Resource
}
}

_, err := conn.ModifyIpamResourceDiscovery(input)
_, err := conn.ModifyIpamResourceDiscoveryWithContext(ctx, input)

if err != nil {
return sdkdiag.AppendErrorf(diags, "updating IPAM Resource Discovery(%s): %s", d.Id(), err)
Expand Down
6 changes: 3 additions & 3 deletions internal/service/ec2/ipam_resource_discovery_association.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ func ResourceIPAMResourceDiscoveryAssociationCreate(ctx context.Context, d *sche

input := &ec2.AssociateIpamResourceDiscoveryInput{
ClientToken: aws.String(resource.UniqueId()),
TagSpecifications: tagSpecificationsFromKeyValueTags(tags, "ipam-resource-discovery-association"),
TagSpecifications: tagSpecificationsFromKeyValueTags(tags, ec2.ResourceTypeIpamResourceDiscoveryAssociation),
IpamId: aws.String(d.Get("ipam_id").(string)),
IpamResourceDiscoveryId: aws.String(d.Get("ipam_resource_discovery_id").(string)),
}

log.Printf("[DEBUG] Creating IPAM Resource Discovery Association: %s", input)
output, err := conn.AssociateIpamResourceDiscovery(input)
output, err := conn.AssociateIpamResourceDiscoveryWithContext(ctx, input)
if err != nil {
return sdkdiag.AppendErrorf(diags, "Error associating ipam resource discovery: %s", err)
}
Expand Down Expand Up @@ -167,7 +167,7 @@ func ResourceIPAMResourceDiscoveryAssociationDelete(ctx context.Context, d *sche
}

log.Printf("[DEBUG] Disassociating IPAM Resource Discovery: %s", d.Id())
_, err := conn.DisassociateIpamResourceDiscovery(input)
_, err := conn.DisassociateIpamResourceDiscoveryWithContext(ctx, input)
if err != nil {
return sdkdiag.AppendErrorf(diags, "error disassociating IPAM Resource Discovery: (%s): %s", d.Id(), err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,27 @@ resource "aws_vpc_ipam_resource_discovery_association" "test" {

The following arguments are supported:

* `description` - (Optional) A description for the IPAM Resource Discovery.
* `operating_regions` - (Required) Determines which regions the Resource Discovery will enable IPAM features for usage and monitoring. Locale is the Region where you want to make an IPAM pool available for allocations. You can only create pools with locales that match the operating Regions of the IPAM Resource Discovery. You can only create VPCs from a pool whose locale matches the VPC's Region. You specify a region using the [region_name](#operating_regions) parameter. **You must set your provider block region as an operating_region.**
* `tags` - (Optional) A map of tags to assign to the resource. If configured with a provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level.

### operating_regions

* `region_name` - (Required) The name of the Region you want to add to the IPAM.
* `description` - (Optional) A description for the IPAM Resource Discovery Association.
* `ipam_id` - (Required) Id of the IPAM to associate
* `resource_discovery_id` - (Required) Id of the Resource Discovery to associate

## Attributes Reference

In addition to all arguments above, the following attributes are exported:

* `arn` - Amazon Resource Name (ARN) of IPAM Resource Discovery
* `id` - The ID of the IPAM Resource Discovery
* `arn` - Amazon Resource Name (ARN) of IPAM Resource Discovery Association
* `id` - The ID of the IPAM Resource Discovery Association
* `is_default` - A boolean to identify if the Resource Discovery is the accounts default resource discovery
* `owner_id` - The account ID for the account that manages the Resource Discovery
* `ipam_resource_discovery_region` - The home region of the Resource Discovery
* `ipam_resource_discovery_region` - The home region of the Resource Discovery Association
* `ipam_region` - The home region of the IPAM
* `ipam_arn` - The arn of the IPAM
* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block).

## Import

IPAMs can be imported using the `ipam resource discovery id`, e.g.
IPAMs can be imported using the `ipam resource discovery association id`, e.g.

```
$ terraform import aws_vpc_ipam_resource_discovery_association.example ipam-res-disco-0178368ad2146a492
$ terraform import aws_vpc_ipam_resource_discovery_association.example ipam-res-disco-assoc-0178368ad2146a492
```

0 comments on commit 3624c2f

Please sign in to comment.