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

Adding gateway and gateway interface resources #358

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

durandx
Copy link

@durandx durandx commented Jan 9, 2023

Adding 2 new resources :

  • ovh_cloud_project_gateway
  • ovh_cloud_project_gateway_interface

* ovh_cloud_project_gateway
* ovh_cloud_project_gateway_interface
Copy link
Collaborator

@scraly scraly left a comment

Choose a reason for hiding this comment

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

Hi,
thanks for your pull request.

Can you add acceptance tests for each of the new resources,
and also documentation pages?

Moreover, if you add two new resources, having datasources can be useful has well.

You can see an example of acceptance tests, documentation pages and datasources in another merged PRs and in the code of this repository.

Thanks :)

@yomovh
Copy link
Member

yomovh commented Jan 19, 2023

@durandx : did you know that you can already create a gateway with the openstack provider ?

This page may help https://docs.ovh.com/gb/en/api/terraform-at-ovhcloud/

@durandx
Copy link
Author

durandx commented Jan 23, 2023

@scraly Thank you for your review and advices for this pull request. Unfortunately, right now, I have no time to work on acceptance tests and documentation + datasources...

@yomovh Yes, that's what we used in the first place, but we were facing a problem for attaching an interface for a gateway created with openstack provider (maybe because we need to define a size for the gateway). Using the OVH API solved this problem, that's why we added this resource (in the ovh provider) using the OVH API.

@scraly
Copy link
Collaborator

scraly commented Feb 13, 2023

@durandx

Thanks for the contribution :)
If you haven't the time to create documentation and acceptance tests, can you copy/paste to us an example of ovh_cloud_project_gateway and ovh_cloud_project_gateway_interface configuration?

Thanks :)

@scraly
Copy link
Collaborator

scraly commented Feb 14, 2023

Hi,

I succesfully created a gateway but when I want to create a gateway_interface I have an issue:

$ 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:

  # ovh_cloud_project_gateway.my-gateway will be created
  + resource "ovh_cloud_project_gateway" "my-gateway" {
      + id           = (known after apply)
      + model        = "s"
      + name         = "my_gateway"
      + network_id   = (known after apply)
      + region       = "GRA5"
      + service_name = "xxxx"
      + status       = (known after apply)
      + subnet_id    = (known after apply)
    }

  # ovh_cloud_project_gateway_interface.my-gateway-interface will be created
  + resource "ovh_cloud_project_gateway_interface" "my-gateway-interface" {
      + gateway_id   = (known after apply)
      + id           = (known after apply)
      + ip           = (known after apply)
      + network_id   = (known after apply)
      + region       = "GRA5"
      + service_name = "xxxx"
      + subnet_id    = (known after apply)
    }

  # ovh_cloud_project_network_private.network will be created
  + resource "ovh_cloud_project_network_private" "network" {
      + id                 = (known after apply)
      + name               = "my_private_network"
      + regions            = [
          + "GRA5",
        ]
      + regions_attributes = (known after apply)
      + regions_status     = (known after apply)
      + service_name       = "xxxxx"
      + status             = (known after apply)
      + type               = (known after apply)
      + vlan_id            = 0
    }

  # ovh_cloud_project_network_private_subnet.networksubnet will be created
  + resource "ovh_cloud_project_network_private_subnet" "networksubnet" {
      + cidr         = (known after apply)
      + dhcp         = true
      + end          = "192.168.168.200"
      + gateway_ip   = (known after apply)
      + id           = (known after apply)
      + ip_pools     = (known after apply)
      + network      = "192.168.168.0/24"
      + network_id   = (known after apply)
      + no_gateway   = false
      + region       = "GRA5"
      + service_name = "xxxx"
      + start        = "192.168.168.100"
    }

Plan: 4 to add, 0 to change, 0 to destroy.

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

ovh_cloud_project_network_private.network: Creating...
ovh_cloud_project_network_private.network: Still creating... [10s elapsed]
ovh_cloud_project_network_private.network: Still creating... [20s elapsed]
ovh_cloud_project_network_private.network: Creation complete after 27s [id=pn-xxxxxx_0]
ovh_cloud_project_network_private_subnet.networksubnet: Creating...
ovh_cloud_project_network_private_subnet.networksubnet: Creation complete after 5s [id=xxxx-xxxx-xxx-xxx-xxx]
ovh_cloud_project_gateway.my-gateway: Creating...
ovh_cloud_project_gateway.my-gateway: Still creating... [10s elapsed]
ovh_cloud_project_gateway.my-gateway: Still creating... [20s elapsed]
ovh_cloud_project_gateway.my-gateway: Creation complete after 24s [id=xx-xx-xx-xx-xxxx]
ovh_cloud_project_gateway_interface.my-gateway-interface: Creating...
╷
│ Error: calling /cloud/project/xxxx/region/GRA5/gateway/xxx-xxxx-xxx-xx-xxxx/interface with params subnetId: xxxxx-xxx-xxxx-xxxx-xxxx:
│ 	 "HTTP Error 409: Client::Conflict: \"conflict: subnet xxxxcxxxxfxxx-xxx-xxxx-xxx already added to gateway\" (X-OVH-Query-Id: EU.ext-xxxxx.xxxx1.cxxxxxxe-xxx-xxx-xxx-xxx)"
│
│   with ovh_cloud_project_gateway_interface.my-gateway-interface,
│   on pr358.tf line 32, in resource "ovh_cloud_project_gateway_interface" "my-gateway-interface":
│   32: resource "ovh_cloud_project_gateway_interface" "my-gateway-interface" {
│

@durandx
Copy link
Author

durandx commented Mar 2, 2023

Hi,

@scraly

We didn't run into this issue, probably because we used more than 1 subnet for the gateway. We have declared the first subnet to the Gateway resource (with ovh_cloud_project_gateway.gateway) and the others subnets have been attached to the gateway_interface (with ovh_cloud_project_gateway_interface.gateway_interface).
The Gateway resource use the API endpoint POST "/cloud/project/%s/region/%s/network/%s/subnet/%s/gateway" (ovh/resource_cloud_project_gateway.go:101) to create the Gateway. And there is no API to only create the Gateway without the subnet.

@DrummyFloyd
Copy link
Contributor

Any update regarding this MR ? would be great to have a native interraction of OVH API for gateway in the provider

@scraly
Copy link
Collaborator

scraly commented Oct 18, 2023

Hi @rbeuque74 , can you have a look? thanks! :-)

@rbeuque74 rbeuque74 self-assigned this Oct 20, 2023
@DrummyFloyd
Copy link
Contributor

DrummyFloyd commented Mar 9, 2024

any update regarding this ?

i've made the part of the MR with test and doc update
related to the gateway resource ( not the interface gateway)

#571

DrummyFloyd pushed a commit to DrummyFloyd/terraform-provider-ovh that referenced this pull request Mar 9, 2024
Signed-off-by: DrummyFloyd <drummy@gmail.com>
Related: ovh#358
DrummyFloyd pushed a commit to DrummyFloyd/terraform-provider-ovh that referenced this pull request Mar 9, 2024
Signed-off-by: DrummyFloyd <drummy@gmail.com>
Related: ovh#358
@DrummyFloyd DrummyFloyd mentioned this pull request Mar 9, 2024
14 tasks
DrummyFloyd added a commit to DrummyFloyd/terraform-provider-ovh that referenced this pull request Mar 11, 2024
Signed-off-by: DrummyFloyd <jonathan.monnet28@gmail.com>
Related: ovh#358
amstuta pushed a commit that referenced this pull request Mar 12, 2024
* feat(cloud): add gateway ressource

Signed-off-by: DrummyFloyd <jonathan.monnet28@gmail.com>
Related: #358
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.

None yet

5 participants