Skip to content

Commit

Permalink
[add_testcase] (#136)
Browse files Browse the repository at this point in the history
* [add_testcase]

Added test-case for "intersight_certificatemanagement_policy"
Updated the example for the same
This testcase is to test the fix of flatten_funtion changes for converting time to string in read function

* [add_testcase]

Add quotes to variable name

* Made private_key and pem_certificate variables private

* [add_testcase]

Added test-case for "intersight_certificatemanagement_policy"
Updated the example for the same
This testcase is to test the fix of flatten_funtion changes for converting time to string in read function

* [add_testcase]

Add quotes to variable name

* Made private_key and pem_certificate variables private

* [add_testcase]

Removed the varibales from tf file as they will be added to internal variables file
  • Loading branch information
meghana-rajashekar authored Oct 18, 2021
1 parent 0e18b7a commit e777c74
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 11 deletions.
22 changes: 11 additions & 11 deletions examples/certificatemanagement/certificatemanagement_policy.md
Original file line number Diff line number Diff line change
@@ -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
}
}
```
16 changes: 16 additions & 0 deletions tests/common/intersight_certificatemanagement_policy.tf
Original file line number Diff line number Diff line change
@@ -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
}
}

18 changes: 18 additions & 0 deletions tests/common/main.tf
Original file line number Diff line number Diff line change
@@ -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"
}
3 changes: 3 additions & 0 deletions tests/common/terraform.tfvars.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
api_key = "changeMe"
secret_key = "changeMe"
endpoint = "changeMe"
14 changes: 14 additions & 0 deletions tests/common/variables.tf
Original file line number Diff line number Diff line change
@@ -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"
}

0 comments on commit e777c74

Please sign in to comment.