diff --git a/examples/certificatemanagement/certificatemanagement_policy.md b/examples/certificatemanagement/certificatemanagement_policy.md index 4d504df8df..3655218830 100644 --- a/examples/certificatemanagement/certificatemanagement_policy.md +++ b/examples/certificatemanagement/certificatemanagement_policy.md @@ -1,19 +1,19 @@ ### Resource Creation ```hcl -resource "intersight_certificatemanagement_policy" "certificatemanagement_policy1" { - name = "certificatemanagement_policy1" - description = "certificate management policy" - certificates = [{ - object_type = "certificatemanagement.Imc" - certificate = { - object_type = "x509.Certificate" - enabled = true - } - }] +resource "intersight_certificatemanagement_policy" "certificate1" { + description = "sample certificate" + name = "certificate1" organization { + moid = var.organization object_type = "organization.Organization" - moid = var.organization_organization } + certificates { + certificate { + pem_certificate = var.pem_certificate + } + enabled = true + privatekey = var.privatekey + } } ``` \ No newline at end of file diff --git a/tests/common/intersight_certificatemanagement_policy.tf b/tests/common/intersight_certificatemanagement_policy.tf new file mode 100644 index 0000000000..999f0eba03 --- /dev/null +++ b/tests/common/intersight_certificatemanagement_policy.tf @@ -0,0 +1,16 @@ +resource "intersight_certificatemanagement_policy" "certificate1" { + description = "sample certificate" + name = "certificate1" + organization { + moid = data.intersight_organization_organization.default.results.0.moid + object_type = "organization.Organization" + } + certificates { + certificate { + pem_certificate = var.pem_certificate + } + enabled = true + privatekey = var.privatekey + } +} + diff --git a/tests/common/main.tf b/tests/common/main.tf new file mode 100644 index 0000000000..7df4bdccd9 --- /dev/null +++ b/tests/common/main.tf @@ -0,0 +1,18 @@ +terraform { + required_providers { + intersight = { + source = "CiscoDevNet/intersight" + version = "1.0.15" + } + } +} + +provider "intersight" { + apikey = var.api_key + secretkey = var.secretkey + endpoint = var.endpoint +} + +data "intersight_organization_organization" "default" { + name = "default" +} diff --git a/tests/common/terraform.tfvars.example b/tests/common/terraform.tfvars.example new file mode 100644 index 0000000000..cb73e6b06e --- /dev/null +++ b/tests/common/terraform.tfvars.example @@ -0,0 +1,3 @@ +api_key = "changeMe" +secret_key = "changeMe" +endpoint = "changeMe" \ No newline at end of file diff --git a/tests/common/variables.tf b/tests/common/variables.tf new file mode 100644 index 0000000000..4a9d34ed45 --- /dev/null +++ b/tests/common/variables.tf @@ -0,0 +1,14 @@ +variable "api_key" { + type = string + description = "API Key Id from Intersight" +} + +variable "secretkey" { + type = string + description = "Secret Key File Path or String" +} + +variable "endpoint" { + type = string + description = "Endpoint URL" +}