diff --git a/.gitignore b/.gitignore index 0221c61..53476b1 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ bin .idea +terraform.tfvars + */.terraform.lock.hcl # Created by https://www.toptal.com/developers/gitignore/api/go,terraform diff --git a/README.md b/README.md index 41ca3d2..6017eda 100644 --- a/README.md +++ b/README.md @@ -3,21 +3,13 @@ ## Description The terraform-provider-acloud is a custom Terraform provider that allows you to manage resources for Avisi Cloud. -## Installation -To use this provider, follow these steps: - -Download the latest release from the [Releases page](https://github.com/avisi-cloud/terraform-provider-acloud/releases). -Extract the binary for your platform. -Place the binary in a directory included in your system's PATH. -Verify the installation by running terraform init in a Terraform configuration that references this provider. - ## Usage ```terraform terraform { required_providers { acloud = { - version = "v0.1.1" + version = "0.1" source = "avisi-cloud/acloud" } } @@ -78,4 +70,5 @@ resource "acloud_nodepool" "staging_nodepool" { ``` ## License + [Apache 2.0 License 2.0](lICENSE) diff --git a/acloud/data_source_cloud_account.go b/acloud/data_source_cloud_account.go index ba5a6ce..19210e7 100644 --- a/acloud/data_source_cloud_account.go +++ b/acloud/data_source_cloud_account.go @@ -51,7 +51,7 @@ func dataCloudAccountRead(ctx context.Context, d *schema.ResourceData, m interfa displayName := d.Get("display_name").(string) cloudProvider := d.Get("cloud_provider").(string) - cloudAccount, err := client.GetCloudAccount(ctx, org, displayName, cloudProvider) + cloudAccount, err := client.FindCloudAccountByName(ctx, org, displayName, cloudProvider) if err != nil { return diag.FromErr(err) } diff --git a/examples/main.tf b/examples/main.tf index fe00b76..7384239 100644 --- a/examples/main.tf +++ b/examples/main.tf @@ -1,66 +1,64 @@ terraform { required_providers { acloud = { - version = "v0.1.1" + version = "0.1" source = "avisi-cloud/acloud" } } } -provider "acloud" {} +variable "acloud_token" { +} + +variable "organisation_slug" { +} + +variable "environment_slug" { +} + +provider "acloud" { + token = var.acloud_token +} -data "acloud_cloud_account" "demo_aws-cloud-account" { - organisation = "demo" - display_name = "staging" +data "acloud_cloud_account" "demo" { + organisation = var.organisation_slug + display_name = "demo" cloud_provider = "aws" } -resource "acloud_environment" "demo_terraform-test" { +resource "acloud_environment" "demo" { name = "terraform-test" type = "demo" - organisation = "demo" + organisation = var.organisation_slug description = "terraform test" } resource "acloud_cluster" "demo_cluster" { name = "tf-demo-cluster" - organisation_slug = acloud_environment.demo_terraform-test.organisation - environment_slug = acloud_environment.demo_terraform-test.slug + organisation_slug = var.organisation_slug + environment_slug = acloud_environment.demo.slug version = "v1.26.9-u-ame.3" region = "eu-west-1" - cloud_account_identity = data.acloud_cloud_account.demo_aws-cloud-account.identity + cloud_account_identity = data.acloud_cloud_account.demo.identity } -resource "acloud_nodepool" "demo-update" { - organisation_slug = acloud_environment.demo_terraform-test.organisation - environment_slug = acloud_environment.demo_terraform-test.slug +resource "acloud_nodepool" "workers" { + organisation_slug = var.organisation_slug + environment_slug = acloud_environment.demo.slug cluster_slug = acloud_cluster.demo_cluster.slug - name = "workers1" + name = "workers" node_size = "t3.small" min_size = 1 max_size = 1 annotations = { "myannotation" = "test" - } + labels = { "role" = "worker" } - - taints { - key = "mytaint" - value = "true" - effect = "NoExecute" - } - - taints { - key = "mysecondtaint" - value = "true" - effect = "NoSchedule" - } - } -output "identity" { - value = data.acloud_cloud_account.demo_aws-cloud-account.identity +output "cloud_account_identity" { + value = data.acloud_cloud_account.demo.identity } diff --git a/go.mod b/go.mod index 1c5fa69..a2666fa 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/avisi-cloud/terraform-proivder-acloud go 1.21 require ( - github.com/avisi-cloud/go-client v0.1.1 + github.com/avisi-cloud/go-client v0.2.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.28.0 golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b ) diff --git a/go.sum b/go.sum index 68b5e0f..5dd948e 100644 --- a/go.sum +++ b/go.sum @@ -3,8 +3,8 @@ github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= -github.com/avisi-cloud/go-client v0.1.1 h1:9W3Ujl6/kW0Ka4GXuM3LiXsoSzDMg3C3Eqo2W0rJF0U= -github.com/avisi-cloud/go-client v0.1.1/go.mod h1:scsRDen1uE9usIfareBJqSMEmgfea3Ve/byhpIleavQ= +github.com/avisi-cloud/go-client v0.2.0 h1:qsv5f70TPZn3KzNMfcOXLqSspG+Y1wSHDZ+clWlfvPI= +github.com/avisi-cloud/go-client v0.2.0/go.mod h1:scsRDen1uE9usIfareBJqSMEmgfea3Ve/byhpIleavQ= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=