Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Direct Link: Dedicated VLAN Mapping #4900

Merged
merged 15 commits into from
Mar 13, 2024

Conversation

MalarvizhiK
Copy link
Member

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Relates OR Closes #0000

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccXXX'

...

@hkantare
Copy link
Collaborator

@MalarvizhiK
Can you fix the checks

@MalarvizhiK
Copy link
Member Author

The GA for the feature is scheduled in 1Q 2024. Hence, I will wait some more time.

@MalarvizhiK
Copy link
Member Author

@hkantare As mentioned earlier, VLAN tagging enablement for DL dedicated feature is GAed.

We want to publish the terraform code for the same.

@MalarvizhiK
Copy link
Member Author

Output from acceptance testing:

malark@Malars-MacBook-Pro terraform-provider-ibm %  make testacc TEST=./ibm/service/directlink TESTARGS='-run=TestAccIBMDLGatewayVC_basic'     
==> Checking that code complies with gofmt requirements...

....
=== RUN   TestAccIBMDLGatewayVC_basic
Create Gateway ....0 VLAN Value Create 0 VLAN Value Create --- PASS: TestAccIBMDLGatewayVC_basic (131.31s)
PASS
ok  	github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/directlink	133.202s

@MalarvizhiK
Copy link
Member Author

Output from acceptance testing

malark@Malars-MacBook-Pro terraform-provider-ibm %  make testacc TEST=./ibm/service/directlink TESTARGS='-run=TestAccIBMDLGatewayConnect_basic'
==> Checking that code complies with gofmt requirements...

=== RUN   TestAccIBMDLGatewayConnect_basic
Create Gateway ....--- PASS: TestAccIBMDLGatewayConnect_basic (649.04s)
PASS
ok  	github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/directlink	650.940s

@MalarvizhiK
Copy link
Member Author

Output from acceptance testing

malark@Malars-MacBook-Pro terraform-provider-ibm %  make testacc TEST=./ibm/service/directlink TESTARGS='-run=TestAccIBMDLGateway_basic'
==> Checking that code complies with gofmt requirements...

=== RUN   TestAccIBMDLGateway_basic
Create Gateway ....0 VLAN Value Create 0 VLAN Value Create 
--- PASS: TestAccIBMDLGateway_basic (109.77s)
PASS
ok  	github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/directlink	111.629s

gatewayDedicatedTemplateModel.Vlan = &mapped_vlan
} else {
vlan := d.Get(dlVlan)
fmt.Printf("%v VLAN Value Create ", vlan)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this fmt stmt

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -1070,7 +1100,8 @@ func resourceIBMdlGatewayRead(d *schema.ResourceData, meta interface{}) error {
}
log.Printf("[INFO] Calling getgateway api: %s", dtype)

instance, response, err := directLink.GetGateway(getOptions)
instanceIntf, response, err := directLink.GetGateway(getOptions)
instance := instanceIntf.(*directlinkv1.GetGatewayResponse)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add some nil check before instanceIntf.(*directlinkv1.GetGatewayResponse) to suppress any nil pinter execeptions

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

ConflictsWith: []string{"remove_vlan"},
ValidateFunc: validate.InvokeValidator("ibm_dl_gateway", dlVlan),
},
dlRemoveVlan: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove_vlan comes only during update scenario?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

@hkantare
Copy link
Collaborator

Share test execuitpn results of respective res/ds

@MalarvizhiK
Copy link
Member Author

Resource block results

malark@Malars-MacBook-Pro dl-test % terraform apply

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # ibm_dl_gateway.test_dl_gateway_new will be created
  + resource "ibm_dl_gateway" "test_dl_gateway_new" {
      + bfd_status                      = (known after apply)
      + bfd_status_updated_at           = (known after apply)
      + bgp_asn                         = 64999
      + bgp_cer_cidr                    = (known after apply)
      + bgp_ibm_asn                     = (known after apply)
      + bgp_ibm_cidr                    = (known after apply)
      + bgp_status                      = (known after apply)
      + bgp_status_updated_at           = (known after apply)
      + carrier_name                    = "myCarrierName"
      + change_request                  = (known after apply)
      + completion_notice_reject_reason = (known after apply)
      + connection_mode                 = (known after apply)
      + created_at                      = (known after apply)
      + crn                             = (known after apply)
      + cross_connect_router            = "LAB-xcr01.dal09"
      + customer_name                   = "myCustomerName"
      + default_export_route_filter     = (known after apply)
      + default_import_route_filter     = (known after apply)
      + global                          = true
      + id                              = (known after apply)
      + link_status                     = (known after apply)
      + link_status_updated_at          = (known after apply)
      + loa_reject_reason               = (known after apply)
      + location_display_name           = (known after apply)
      + location_name                   = "dal09"
      + metered                         = true
      + name                            = "gatewaynew"
      + operational_status              = (known after apply)
      + port                            = (known after apply)
      + provider_api_managed            = (known after apply)
      + remove_vlan                     = false
      + resource_controller_url         = (known after apply)
      + resource_crn                    = (known after apply)
      + resource_group                  = "bf823d4f45b64ceaa4671bee0479346e"
      + resource_group_name             = (known after apply)
      + resource_name                   = (known after apply)
      + resource_status                 = (known after apply)
      + speed_mbps                      = 1000
      + tags                            = (known after apply)
      + type                            = "dedicated"
      + vlan                            = 3967
    }

Plan: 1 to add, 0 to change, 0 to destroy.
╷
│ Warning: Argument is deprecated
│ 
│   with provider["registry.terraform.io/ibm-cloud/ibm"],
│   on main.tf line 19, in provider "ibm":
│   19:   generation = 2
│ 
│ The generation field is deprecated and will be removed after couple of releases
│ 
│ (and one more similar warning elsewhere)
╵

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

ibm_dl_gateway.test_dl_gateway_new: Creating...
ibm_dl_gateway.test_dl_gateway_new: Still creating... [10s elapsed]
ibm_dl_gateway.test_dl_gateway_new: Still creating... [20s elapsed]
ibm_dl_gateway.test_dl_gateway_new: Creation complete after 22s [id=35e37215-e349-459e-a45f-82eb4adfadf1]
╷
│ Warning: Argument is deprecated
│ 
│   with provider["registry.terraform.io/ibm-cloud/ibm"],
│   on main.tf line 19, in provider "ibm":
│   19:   generation = 2
│ 
│ The generation field is deprecated and will be removed after couple of releases
╵

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
malark@Malars-MacBook-Pro dl-test % terraform show
# ibm_dl_gateway.test_dl_gateway_new:
resource "ibm_dl_gateway" "test_dl_gateway_new" {
    bgp_asn                     = 64999
    bgp_cer_cidr                = "169.254.0.22/30"
    bgp_ibm_asn                 = 13884
    bgp_ibm_cidr                = "169.254.0.21/30"
    bgp_status                  = "idle"
    bgp_status_updated_at       = "2024-03-13T06:46:43.074Z"
    carrier_name                = "myCarrierName"
    connection_mode             = "direct"
    created_at                  = "2024-03-13T06:46:46.475Z"
    crn                         = "crn:v1:staging:public:directlink:dal09:a/3b1bd7fa2bc3406ea70ba4ade8aa3f1b::dedicated:35e37215-e349-459e-a45f-82eb4adfadf1"
    cross_connect_router        = "LAB-xcr01.dal09"
    customer_name               = "myCustomerName"
    default_export_route_filter = "permit"
    default_import_route_filter = "permit"
    global                      = true
    id                          = "35e37215-e349-459e-a45f-82eb4adfadf1"
    link_status                 = "down"
    link_status_updated_at      = "2024-03-13T06:46:43.074Z"
    location_display_name       = "Dallas 09"
    location_name               = "dal09"
    metered                     = true
    name                        = "gatewaynew"
    operational_status          = "awaiting_loa"
    remove_vlan                 = false
    resource_controller_url     = "https://test.cloud.ibm.com/interconnectivity/direct-link"
    resource_crn                = "crn:v1:staging:public:directlink:dal09:a/3b1bd7fa2bc3406ea70ba4ade8aa3f1b::dedicated:35e37215-e349-459e-a45f-82eb4adfadf1"
    resource_group              = "bf823d4f45b64ceaa4671bee0479346e"
    resource_group_name         = "bf823d4f45b64ceaa4671bee0479346e"
    resource_name               = "gatewaynew"
    resource_status             = "awaiting_loa"
    speed_mbps                  = 1000
    tags                        = []
    type                        = "dedicated"
    vlan                        = 3967
}
malark@Malars-MacBook-Pro dl-test % 

@hkantare hkantare merged commit 9bbbe8b into IBM-Cloud:master Mar 13, 2024
1 check passed
@MalarvizhiK
Copy link
Member Author

Data block results

data "ibm_dl_gateway" "test_dl_gateway" {
                        name = ibm_dl_gateway.test_dl_gateway_new.name
                 }

output "dl_instances" {
  value = data.ibm_dl_gateway.test_dl_gateway
}

Outputs:


dl_instances = {
    as_prepends                 = []
    bgp_asn                     = 64999
    bgp_cer_cidr                = "169.254.0.22/30"
    bgp_ibm_asn                 = 13884
    bgp_ibm_cidr                = "169.254.0.21/30"
    bgp_status                  = "connect"
    bgp_status_updated_at       = "2024-03-13T07:00:38.738Z"
    connection_mode             = "direct"
    created_at                  = "2024-03-13T06:46:46.475Z"
    crn                         = "crn:v1:staging:public:directlink:dal09:a/3b1bd7fa2bc3406ea70ba4ade8aa3f1b::dedicated:35e37215-e349-459e-a45f-82eb4adfadf1"
    cross_connect_router        = "LAB-xcr01.dal09"
    default_export_route_filter = "permit"
    default_import_route_filter = "permit"
    gateway_vcs                 = []
    global                      = true
    id                          = "35e37215-e349-459e-a45f-82eb4adfadf1"
    link_status                 = "down"
    link_status_updated_at      = "2024-03-13T06:46:43.074Z"
    location_display_name       = "Dallas 09"
    location_name               = "dal09"
    metered                     = true
    name                        = "gatewaynew"
    operational_status          = "awaiting_loa"
    resource_group              = "bf823d4f45b64ceaa4671bee0479346e"
    speed_mbps                  = 1000
    type                        = "dedicated"
    vlan                        = 3967
}



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants