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

Add Cloud Database IP Restriction provider #276

Merged
merged 1 commit into from
Jul 27, 2022

Conversation

lpatte
Copy link
Contributor

@lpatte lpatte commented Jul 15, 2022

Database Ip Restriction : Resource and Datasource
Database cluster : Datasource

@lpatte lpatte force-pushed the PUD-1388_manage-ip-restriction branch 2 times, most recently from 54ac4a2 to e99fad6 Compare July 20, 2022 12:50
@lpatte lpatte force-pushed the PUD-1388_manage-ip-restriction branch from e99fad6 to 59c4506 Compare July 22, 2022 10:01
@scraly scraly changed the title Add Cloud Database Ip Restriction provider Add Cloud Database IP Restriction provider Jul 25, 2022
@scraly
Copy link
Collaborator

scraly commented Jul 26, 2022

Thanks for the PR :)

In the Control Plane we can add several IPs but currently it's only possible to add only one IP with this PR.

Is it possible to allow to add a list of IP/CIDR, like in the managed kubernetes?

resource "ovh_cloud_project_kube_iprestrictions" "iprestrictions" {
	service_name  = ovh_cloud_project_kube.cluster.service_name
	kube_id       = ovh_cloud_project_kube.cluster.id
       ips           = ["10.42.0.0/16"]
}

So the idea is to have something like this:

resource "ovh_cloud_project_database_ip_restriction" "iprestriction" {
  service_name = ovh_cloud_project_database.db.service_name
  engine = ovh_cloud_project_database.db.engine
  cluster_id  = ovh_cloud_project_database.db.id
  ips           = ["178.97.6.0/24", "178.97.7.0/24"]
}

Thanks :)

@scraly
Copy link
Collaborator

scraly commented Jul 26, 2022

Moreover, terraform import of IP restrictions is KO because you need to add the IP of the restriction for all of the imports but in my case I have two IPs:

$ terraform import ovh_cloud_project_database_ip_restriction.iprestriction a212a1e43b614c4ba27a247b890fcf59/mysql/daece041-6f90-48fe-850f-565c1fba33b9/178.97.7.0/24
ovh_cloud_project_database_ip_restriction.iprestriction: Importing from ID "a212a1e43b614c4ba27a247b890fcf59/mysql/daece041-6f90-48fe-850f-565c1fba33b9/178.97.7.0/24"...
ovh_cloud_project_database_ip_restriction.iprestriction: Import prepared!
  Prepared ovh_cloud_project_database_ip_restriction for import
ovh_cloud_project_database_ip_restriction.iprestriction: Refreshing state... [id=3118842332]

Import successful!

The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.
$ terraform import ovh_cloud_project_database_ip_restriction.iprestriction a212a1e43b614c4ba27a247b890fcf59/mysql/daece041-6f90-48fe-850f-565c1fba33b9/178.97.6.0/24
ovh_cloud_project_database_ip_restriction.iprestriction: Importing from ID "a212a1e43b614c4ba27a247b890fcf59/mysql/daece041-6f90-48fe-850f-565c1fba33b9/178.97.6.0/24"...
ovh_cloud_project_database_ip_restriction.iprestriction: Import prepared!
  Prepared ovh_cloud_project_database_ip_restriction for import
╷
│ Error: Resource already managed by Terraform
│
│ Terraform is already managing a remote object for ovh_cloud_project_database_ip_restriction.iprestriction. To import to this address you must first remove the existing object from the state.
╵

So a solution can be to allow to add ips :)

Thx

@lpatte lpatte force-pushed the PUD-1388_manage-ip-restriction branch from 59c4506 to 1c5977e Compare July 26, 2022 13:48
@lpatte lpatte force-pushed the PUD-1388_manage-ip-restriction branch 2 times, most recently from 4f007f1 to 4dbc1cf Compare July 27, 2022 09:03
@lpatte lpatte force-pushed the PUD-1388_manage-ip-restriction branch from 4dbc1cf to 3fb325f Compare July 27, 2022 13:24
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.

Thanks :)

@scraly scraly merged commit ae42e65 into ovh:master Jul 27, 2022
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.

3 participants