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 resource & data source instance #696

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Tiboau
Copy link
Contributor

@Tiboau Tiboau commented Jul 26, 2024

Description

Add resource and datasource for instance(s)

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • Documentation update

How Has This Been Tested?

export OVH_CLOUD_PROJECT_SERVICE_TEST="AAA"
export OVH_CLOUD_PROJECT_REGION_TEST="XXX"
export OVH_CLOUD_PROJECT_IMAGE_ID_TEST="YYYY"
export OVH_CLOUD_PROJECT_FLAVOR_ID_TEST="ZZZZZ"
export OVH_CLOUD_PROJECT_SSH_NAME_TEST="UUUUU"
export OVH_CLOUD_PROJECT_INSTANCE_NAME_TEST="VVVVVV"

➜  terraform-provider-ovh git:(resource_cloud_project_instance.go) make testacc TESTARGS="-run TestAccCloudProjectInstance_basic"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run TestAccCloudProjectInstance_basic -timeout 600m -p 10
?       github.com/ovh/terraform-provider-ovh   [no test files]
?       github.com/ovh/terraform-provider-ovh/ovh/helpers       [no test files]
?       github.com/ovh/terraform-provider-ovh/ovh/types [no test files]
=== RUN   TestAccCloudProjectInstance_basic
    provider_test.go:398: Read Cloud Project /cloud/project/bad3308a4b4d4dcba4d15d5b082d7225 -> status: 'ok', desc: 'Production'
--- PASS: TestAccCloudProjectInstance_basic (55.30s)
PASS
ok      github.com/ovh/terraform-provider-ovh/ovh       55.310s
testing: warning: no tests to run
PASS
ok      github.com/ovh/terraform-provider-ovh/ovh/helpers/hashcode      (cached) [no tests to run]
export OVH_CLOUD_PROJECT_SERVICE_TEST="AAA"
export OVH_CLOUD_PROJECT_REGION_TEST="XXX"
➜  terraform-provider-ovh git:(resource_cloud_project_instance.go) make testacc TESTARGS="-run TestAccDataSourceCloudProjecInstances_basic"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run TestAccDataSourceCloudProjecInstances_basic -timeout 600m -p 10
?       github.com/ovh/terraform-provider-ovh   [no test files]
?       github.com/ovh/terraform-provider-ovh/ovh/helpers       [no test files]
?       github.com/ovh/terraform-provider-ovh/ovh/types [no test files]
=== RUN   TestAccDataSourceCloudProjecInstances_basic
    provider_test.go:398: Read Cloud Project /cloud/project/bad3308a4b4d4dcba4d15d5b082d7225 -> status: 'ok', desc: 'Production'
--- PASS: TestAccDataSourceCloudProjecInstances_basic (6.78s)
PASS
ok      github.com/ovh/terraform-provider-ovh/ovh       6.788s
testing: warning: no tests to run
PASS
ok      github.com/ovh/terraform-provider-ovh/ovh/helpers/hashcode      (cached) [no tests to run]
export OVH_CLOUD_PROJECT_SERVICE_TEST="AAA"
export OVH_CLOUD_PROJECT_REGION_TEST="XXX"
export OVH_CLOUD_PROJECT_INSTANCE_ID_TEST="YYYY"
➜  terraform-provider-ovh git:(resource_cloud_project_instance.go) make testacc TESTARGS="-run TestAccDataSourceCloudProjecInstances_basic"
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run TestAccDataSourceCloudProjecInstancesbasic -timeout 600m -p 10
?       github.com/ovh/terraform-provider-ovh   [no test files]
?       github.com/ovh/terraform-provider-ovh/ovh/helpers       [no test files]
?       github.com/ovh/terraform-provider-ovh/ovh/types [no test files]
testing: warning: no tests to run
PASS
ok      github.com/ovh/terraform-provider-ovh/ovh       0.011s [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/ovh/terraform-provider-ovh/ovh/helpers/hashcode      0.003s [no tests to run]

Test Configuration:

  • Terraform version: terraform version: Terraform vx.y.z
  • Existing HCL configuration you used:
resource "ovh_cloud_project_instance" "instance" {
    region = "BHS5"
    billing_period = "hourly"
    boot_from {
        image_id = "7ec6515e-b390-41f8-a26a-cca7e223ca2d"
    }
    flavor {
        flavor_id = "ac6f8199-3595-446f-bfc7-c80cdfcf9cbe"
    }
    name = "haproxy"
    ssh_key {
        name = "ovh_cloud"
    }
    network {
        public = true
    }   
}

data "ovh_cloud_project_instances" "instances" {
   region = ovh_cloud_project_instance.instance.region
}

data "ovh_cloud_project_instance" "desc" {
   region = ovh_cloud_project_instance.instance.region
   instance_id = ovh_cloud_project_instance.instance.id
}

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or issues
  • I have added acceptance tests that prove my fix is effective or that my feature works
  • New and existing acceptance tests pass locally with my changes
  • I ran succesfully go mod vendor if I added or modify go.mod file

ovh/data_cloud_project_instance.go Outdated Show resolved Hide resolved
ovh/data_cloud_project_instance.go Outdated Show resolved Hide resolved
ovh/data_cloud_project_instance.go Outdated Show resolved Hide resolved
ovh/data_cloud_project_instance.go Outdated Show resolved Hide resolved
ovh/data_cloud_project_instance.go Outdated Show resolved Hide resolved
ovh/resource_cloud_project_instance.go Outdated Show resolved Hide resolved
ovh/resource_cloud_project_instance_test.go Show resolved Hide resolved
website/docs/d/cloud_project_instances.markdown Outdated Show resolved Hide resolved
website/docs/d/cloud_project_instances.markdown Outdated Show resolved Hide resolved
website/docs/d/cloud_project_instances.markdown Outdated Show resolved Hide resolved
Type: schema.TypeList,
Required: true,
Description: "Flavor information",
ForceNew: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

is this really true ? It seems that right now with openstack provider you can change flavor without recreating

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will be in v2

ovh/data_cloud_project_instance.go Outdated Show resolved Hide resolved
ovh/resource_cloud_project_instance.go Show resolved Hide resolved
ovh/resource_cloud_project_instance_test.go Outdated Show resolved Hide resolved
@Tiboau Tiboau force-pushed the resource_cloud_project_instance.go branch from 808b25c to 340c8b7 Compare October 9, 2024 15:00
@scraly
Copy link
Collaborator

scraly commented Nov 26, 2024

Hi, any news in this Public Cloud Instance (compute) resource and datasource? :)

@amstuta
Copy link
Contributor

amstuta commented Nov 29, 2024

Hi, any news in this Public Cloud Instance (compute) resource and datasource? :)

@Tiboau anything blocking ?

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