Skip to content

Commit

Permalink
added missing crn to vpc resources
Browse files Browse the repository at this point in the history
  • Loading branch information
ujjwal-ibm authored and hkantare committed Sep 17, 2021
1 parent a74006a commit ad2bd20
Show file tree
Hide file tree
Showing 24 changed files with 91 additions and 1 deletion.
9 changes: 9 additions & 0 deletions ibm/data_source_ibm_is_floating_ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const (
floatingIPZone = "zone"
floatingIPTarget = "target"
floatingIPTags = "tags"
floatingIPCRN = "crn"
)

func dataSourceIBMISFloatingIP() *schema.Resource {
Expand Down Expand Up @@ -55,6 +56,12 @@ func dataSourceIBMISFloatingIP() *schema.Resource {
Description: "Target info",
},

floatingIPCRN: {
Type: schema.TypeString,
Computed: true,
Description: "Floating IP crn",
},

floatingIPTags: {
Type: schema.TypeSet,
Computed: true,
Expand Down Expand Up @@ -107,6 +114,8 @@ func floatingIPGet(d *schema.ResourceData, meta interface{}, name string) error
d.Set(floatingIPStatus, *ip.Status)
d.Set(floatingIPZone, *ip.Zone.Name)

d.Set(floatingIPCRN, *ip.CRN)

target, ok := ip.Target.(*vpcv1.FloatingIPTarget)
if ok {
d.Set(floatingIPTarget, target.ID)
Expand Down
7 changes: 7 additions & 0 deletions ibm/data_source_ibm_is_instance_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ func dataSourceIBMISInstanceGroup() *schema.Resource {
Description: "Resource group ID",
},

"crn": {
Type: schema.TypeString,
Computed: true,
Description: "The CRN for this instance group",
},

"subnets": {
Type: schema.TypeList,
Elem: &schema.Schema{Type: schema.TypeString},
Expand Down Expand Up @@ -116,6 +122,7 @@ func dataSourceIBMISInstanceGroupRead(d *schema.ResourceData, meta interface{})
d.Set("instance_template", *instanceGroup.InstanceTemplate.ID)
d.Set("membership_count", *instanceGroup.MembershipCount)
d.Set("resource_group", *instanceGroup.ResourceGroup.ID)
d.Set("crn", *instanceGroup.CRN)
d.SetId(*instanceGroup.ID)
if instanceGroup.ApplicationPort != nil {
d.Set("application_port", *instanceGroup.ApplicationPort)
Expand Down
7 changes: 7 additions & 0 deletions ibm/data_source_ibm_is_lb.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ func dataSourceIBMISLB() *schema.Resource {
Description: "Load Balancer status",
},

isLBCrn: {
Type: schema.TypeString,
Computed: true,
Description: "The CRN for this Load Balancer",
},

isLBOperatingStatus: {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -279,6 +285,7 @@ func lbGetByName(d *schema.ResourceData, meta interface{}, name string) error {
d.Set(isLBType, "private")
}
d.Set(isLBStatus, *lb.ProvisioningStatus)
d.Set(isLBCrn, *lb.CRN)
d.Set(isLBOperatingStatus, *lb.OperatingStatus)
publicIpList := make([]string, 0)
if lb.PublicIps != nil {
Expand Down
7 changes: 7 additions & 0 deletions ibm/data_source_ibm_is_security_group_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ func dataSourceIBMISSecurityGroupTarget() *schema.Resource {
Description: "Security group target name",
},

"crn": {
Type: schema.TypeString,
Computed: true,
Description: "The CRN for this security group target",
},

"resource_type": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -90,6 +96,7 @@ func dataSourceIBMISSecurityGroupTargetRead(d *schema.ResourceData, meta interfa
securityGroupTargetReference := securityGroupTargetReferenceIntf.(*vpcv1.SecurityGroupTargetReference)
if *securityGroupTargetReference.Name == name {
d.Set("target", *securityGroupTargetReference.ID)
d.Set("crn", securityGroupTargetReference.CRN)
// d.Set("resource_type", *securityGroupTargetReference.ResourceType)
if securityGroupTargetReference.Deleted != nil {
d.Set("more_info", *securityGroupTargetReference.Deleted.MoreInfo)
Expand Down
7 changes: 7 additions & 0 deletions ibm/data_source_ibm_is_security_group_targets.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ func dataSourceIBMISSecurityGroupTargets() *schema.Resource {
Description: "security group target identifier",
},

"crn": {
Type: schema.TypeString,
Computed: true,
Description: "The CRN for this target",
},

"name": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -101,6 +107,7 @@ func dataSourceIBMISSecurityGroupTargetsRead(d *schema.ResourceData, meta interf
tr := map[string]interface{}{
"name": *securityGroupTargetReference.Name,
"target": *securityGroupTargetReference.ID,
"crn": securityGroupTargetReference.CRN,
// "resource_type": *securityGroupTargetReference.ResourceType,
}
if securityGroupTargetReference.Deleted != nil {
Expand Down
6 changes: 6 additions & 0 deletions ibm/data_source_ibm_is_virtual_endpoint_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ func dataSourceIBMISEndpointGateway() *schema.Resource {
Computed: true,
Description: "Endpoint gateway resource type",
},
isVirtualEndpointGatewayCRN: {
Type: schema.TypeString,
Computed: true,
Description: "The CRN for this Endpoint gateway",
},
isVirtualEndpointGatewayResourceGroupID: {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -134,6 +139,7 @@ func dataSourceIBMISEndpointGatewayRead(
if *result.Name == name {
d.SetId(*result.ID)
d.Set(isVirtualEndpointGatewayName, result.Name)
d.Set(isVirtualEndpointGatewayCRN, result.CRN)
d.Set(isVirtualEndpointGatewayHealthState, result.HealthState)
d.Set(isVirtualEndpointGatewayCreatedAt, result.CreatedAt.String())
d.Set(isVirtualEndpointGatewayLifecycleState, result.LifecycleState)
Expand Down
6 changes: 6 additions & 0 deletions ibm/data_source_ibm_is_virtual_endpoint_gateways.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ func dataSourceIBMISEndpointGateways() *schema.Resource {
Computed: true,
Description: "The resource group id",
},
isVirtualEndpointGatewayCRN: {
Type: schema.TypeString,
Computed: true,
Description: "The CRN for this Endpoint Gateway",
},
isVirtualEndpointGatewayCreatedAt: {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -154,6 +159,7 @@ func dataSourceIBMISEndpointGatewaysRead(d *schema.ResourceData, meta interface{
endpointGatewayOutput[isVirtualEndpointGatewayHealthState] = *endpointGateway.HealthState
endpointGatewayOutput[isVirtualEndpointGatewayLifecycleState] = *endpointGateway.LifecycleState
endpointGatewayOutput[isVirtualEndpointGatewayResourceGroupID] = *endpointGateway.ResourceGroup.ID
endpointGatewayOutput[isVirtualEndpointGatewayCRN] = *endpointGateway.CRN
endpointGatewayOutput[isVirtualEndpointGatewayVpcID] = *endpointGateway.VPC.ID
endpointGatewayOutput[isVirtualEndpointGatewayTarget] =
flattenEndpointGatewayTarget(endpointGateway.Target.(*vpcv1.EndpointGatewayTarget))
Expand Down
6 changes: 6 additions & 0 deletions ibm/resource_ibm_is_instance_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ func resourceIBMISInstanceGroup() *schema.Resource {
Computed: true,
Description: "Resource group ID",
},
"crn": {
Type: schema.TypeString,
Computed: true,
Description: "The CRN of this instance group",
},

"subnets": {
Type: schema.TypeList,
Expand Down Expand Up @@ -392,6 +397,7 @@ func resourceIBMISInstanceGroupRead(d *schema.ResourceData, meta interface{}) er

d.Set("status", *instanceGroup.Status)
d.Set("vpc", *instanceGroup.VPC.ID)
d.Set("crn", *instanceGroup.CRN)
tags, err := GetTagsUsingCRN(meta, *instanceGroup.CRN)
if err != nil {
log.Printf(
Expand Down
2 changes: 2 additions & 0 deletions ibm/resource_ibm_is_instance_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

const (
isInstanceTemplateBootVolume = "boot_volume"
isInstanceTemplateCRN = "crn"
isInstanceTemplateVolAttVolAutoDelete = "auto_delete"
isInstanceTemplateVolAttVol = "volume"
isInstanceTemplateVolAttachmentName = "name"
Expand Down Expand Up @@ -702,6 +703,7 @@ func instanceTemplateGet(d *schema.ResourceData, meta interface{}, ID string) er
}
instance := instanceIntf.(*vpcv1.InstanceTemplate)
d.Set(isInstanceTemplateName, *instance.Name)
d.Set(isInstanceTemplateCRN, *instance.CRN)
if instance.Profile != nil {
instanceProfileIntf := instance.Profile
identity := instanceProfileIntf.(*vpcv1.InstanceProfileIdentity)
Expand Down
8 changes: 8 additions & 0 deletions ibm/resource_ibm_is_lb.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
const (
isLBName = "name"
isLBStatus = "status"
isLBCrn = "crn"
isLBTags = "tags"
isLBType = "type"
isLBSubnets = "subnets"
Expand Down Expand Up @@ -83,6 +84,12 @@ func resourceIBMISLB() *schema.Resource {
Computed: true,
},

isLBCrn: {
Type: schema.TypeString,
Computed: true,
Description: "The CRN for this Load Balancer",
},

isLBOperatingStatus: {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -376,6 +383,7 @@ func lbGet(d *schema.ResourceData, meta interface{}, id string) error {
d.Set(isLBType, "private")
}
d.Set(isLBStatus, *lb.ProvisioningStatus)
d.Set(isLBCrn, *lb.CRN)
d.Set(isLBOperatingStatus, *lb.OperatingStatus)
publicIpList := make([]string, 0)
if lb.PublicIps != nil {
Expand Down
6 changes: 6 additions & 0 deletions ibm/resource_ibm_is_security_group_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ func resourceIBMISSecurityGroupTarget() *schema.Resource {
Computed: true,
Description: "Security group target name",
},
"crn": {
Type: schema.TypeString,
Computed: true,
Description: "The CRN for this Security group target",
},

isSecurityGroupResourceType: {
Type: schema.TypeString,
Expand Down Expand Up @@ -134,6 +139,7 @@ func resourceIBMISSecurityGroupTargetRead(d *schema.ResourceData, meta interface

target := data.(*vpcv1.SecurityGroupTargetReference)
d.Set("name", *target.Name)
d.Set("crn", target.CRN)
if target.ResourceType != nil && *target.ResourceType != "" {
d.Set(isSecurityGroupResourceType, *target.ResourceType)
}
Expand Down
7 changes: 7 additions & 0 deletions ibm/resource_ibm_is_virtual_endpoint_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
const (
isVirtualEndpointGatewayName = "name"
isVirtualEndpointGatewayResourceType = "resource_type"
isVirtualEndpointGatewayCRN = "crn"
isVirtualEndpointGatewayResourceGroupID = "resource_group"
isVirtualEndpointGatewayCreatedAt = "created_at"
isVirtualEndpointGatewayIPs = "ips"
Expand Down Expand Up @@ -73,6 +74,11 @@ func resourceIBMISEndpointGateway() *schema.Resource {
Computed: true,
Description: "Endpoint gateway resource type",
},
isVirtualEndpointGatewayCRN: {
Type: schema.TypeString,
Computed: true,
Description: "The CRN for this Endpoint gateway",
},
isVirtualEndpointGatewayResourceGroupID: {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -336,6 +342,7 @@ func resourceIBMisVirtualEndpointGatewayRead(d *schema.ResourceData, meta interf
d.Set(isVirtualEndpointGatewayCreatedAt, result.CreatedAt.String())
d.Set(isVirtualEndpointGatewayLifecycleState, result.LifecycleState)
d.Set(isVirtualEndpointGatewayResourceType, result.ResourceType)
d.Set(isVirtualEndpointGatewayCRN, result.CRN)
d.Set(isVirtualEndpointGatewayIPs, flattenIPs(result.Ips))
d.Set(isVirtualEndpointGatewayResourceGroupID, result.ResourceGroup.ID)
d.Set(isVirtualEndpointGatewayTarget,
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/is_floating_ip.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Review the argument references that you can specify for your data source.
In addition to the argument reference list, you can access the following attribute references after your data source is created.

- `address` - (String) The floating IP address that is created.
- `crn` - (String) The CRN for this floating IP.
- `id` - (String) The unique identifier of the floating IP.
- `status` - (String) Provisioning status of the floating IP address.
- `tags` - (String) The tags associated with VPC.
Expand Down
3 changes: 2 additions & 1 deletion website/docs/d/is_instance_group.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ Review the argument references that you can specify for your data source.
In addition to the argument reference list, you can access the following attribute references after your data source is created.

- `application_port` - (String) Scales an instances to supply the port for the Load Balancer pool member.
- `id`- (Object) The ID of an instance group.
- `crn`- (String) The CRN for this instance group.
- `id`- (String) The ID of an instance group.
- `instance_template` - (String) The ID of an instance template to create an instance group.
- `instance_count` - (String) The number of instances created in an instance group.
- `load_balancer_pool` - (String) The Load Balancer pool ID.
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/is_lb.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Review the argument references that you can specify for your data source.
## Attribute reference
In addition to all argument reference list, you can access the following attribute references after your data source is created.

- `crn` - (String) The CRN for this load balancer.
- `hostname` - (String) Fully qualified domain name assigned to this load balancer.
- `id` - (String) The ID of the load balancer.
- `listeners` - (String) The ID of the listeners attached to this load balancer.
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/is_security_group_target.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Review the argument references that you can specify for your resource.
## Attribute reference
In addition to all argument reference list, you can access the following attribute references after your data source is created.

- `crn` - (String) The CRN for this target.
- `id` - (String) The unique identifier of the security group target. The ID is composed of <`security_group_id`>/<`target_id`>.
- `name` - (String) The user defined name of the target.
- `resource_type` - (String) The resource type.
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/is_security_group_targets.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ In addition to all argument reference list, you can access the following attribu
- `targets` - (List) Collection of security group target references

Nested scheme for `targets`:
- `crn` - (String) The CRN for this target
- `target` - (String) The unique identifier for this load balancer/network interface
- `name` - (String) The user-defined name of the target
- `resource_type` - (String) The resource type
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/is_virtual_endpoint_gateway.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Review the argument references that you can specify for your data source.
In addition to the argument reference list, you can access the following attribute references after your data source is created.

- `created_at` - (Timestamp) The created date and time of the endpoint gateway.
- `crn` - (String) The CRN for this endpoint gateway.
- `health_state` - (String) Endpoint gateway health state. `ok: Healthy`, `degraded: Suffering from compromised performance, capacity, or connectivity`, `faulted: Completely unreachable, inoperative, or entirely incapacitated`, `inapplicable: The health state does not apply because of the current lifecycle state`. A resource with a lifecycle state of failed or deleting will have a health state of inapplicable. A pending resource may have this state.
- `lifecycle_state` - (String) The endpoint gateway lifecycle state, supported values are **deleted**, **deleting**, **failed**, **pending**, **stable**, **updating**, **waiting**, **suspended**.
- `ips` - (List) The unique identifier for the reserved IP.
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/is_virtual_endpoint_gateways.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ In addition to the argument reference list, you can access the following attribu

Nested scheme for `virtual_endpoint_gateways`:
- `created_at` - (Timestamp) The created date and time of the endpoint gateway.
- `crn` - (String) The CRN for this endpoint gateway.
- `health_state` - (String) The endpoint gateway health state. **ok: Healthy**, **degraded: Suffering from compromised performance, capacity, or connectivity**, **faulted: Completely unreachable, inoperative, or entirely incapacitated**, **inapplicable: The health state does not apply because of the current lifecycle state**. A resource with a lifecycle state of failed or deleting will have a health state of inapplicable. A pending resource may have this state.
- `lifecycle_state` - (String) The endpoint gateway lifecycle state, supported values are `deleted`, `deleting`, `failed`, `pending`, `stable`, `updating`, `waiting`, `suspended`.
- `id` - (String) The endpoint gateway ID.
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/is_instance_group.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Review the argument references that you can specify for your resource.
## Attribute reference
In addition to all argument reference list, you can access the following attribute reference after your resource is created.

- `crn` - (String) The CRN for this instance group.
- `id` - (String) The ID of an instance group.
- `instances` - (String) The number of instances in the instances group.
- `managers` - (String) List of managers associated with the instance group.
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/is_instance_template.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ Review the argument references that you can specify for your resource.
## Attribute reference
In addition to all arguments listed, you can access the following attribute references after your resource is created.

- `crn` - (String) The CRN for this instance template.
- `id` - (String) The ID of an instance template.

## Import
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/is_lb.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Review the argument references that you can specify for your resource.
## Attribute reference
In addition to all argument reference list, you can access the following attribute reference after your resource is created.

- `crn` - (String) The CRN for this load balancer.
- `hostname` - (String) The fully qualified domain name assigned to this load balancer.
- `id` - (String) The unique identifier of the load balancer.
- `operating_status` - (String) The operating status of this load balancer.
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/is_security_group_target.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Review the argument references that you can specify for your resource.
## Attribute reference
In addition to all argument reference list, you can access the following attribute reference after your resource is created.

- `crn` - (String) The CRN for this target.
- `id` - (String) The unique identifier of the security group target. The id is composed of <`security_group_id`>/<`target_id`>.
- `name` - (String) The user-defined name of the target.
- `resource_type` - (String) The resource type.
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/is_virtual_endpoint_gateway.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ Review the argument references that you can specify for your resource.
In addition to all argument reference list, you can access the following attribute reference after your resource is created.

- `created_at` - (Timestamp) The created date and time of the endpoint gateway.
- `crn` - (String) The CRN for this endpoint gateway.
- `health_state` - (String) The health state of the endpoint gateway.
- `id` - (String) The unique identifier of the VPE Gateway. The ID is composed of `<gateway_id>`.
- `ips` (List) The endpoint gateway resource group.
Expand Down

0 comments on commit ad2bd20

Please sign in to comment.