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

azurerm_automation_certificate - Allow exportable property to be set #12738

Merged
merged 3 commits into from
Jul 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func resourceAutomationCertificate() *pluginsdk.Resource {
"exportable": {
Type: pluginsdk.TypeBool,
Computed: true,
Optional: true,
},

"thumbprint": {
Expand All @@ -85,6 +86,7 @@ func resourceAutomationCertificateCreateUpdate(d *pluginsdk.ResourceData, meta i
name := d.Get("name").(string)
resourceGroup := d.Get("resource_group_name").(string)
accountName := d.Get("automation_account_name").(string)
exportable := d.Get("exportable").(bool)

if d.IsNewResource() {
existing, err := client.Get(ctx, resourceGroup, accountName, name)
Expand All @@ -104,7 +106,8 @@ func resourceAutomationCertificateCreateUpdate(d *pluginsdk.ResourceData, meta i
parameters := automation.CertificateCreateOrUpdateParameters{
Name: &name,
CertificateCreateOrUpdateProperties: &automation.CertificateCreateOrUpdateProperties{
Description: &description,
Description: &description,
IsExportable: &exportable,
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ resource "azurerm_automation_certificate" "test" {
automation_account_name = azurerm_automation_account.test.name
base64 = "%s"
description = "This is a test certificate for terraform acceptance test"
exportable = true
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, testCertBase64)
}
Expand Down Expand Up @@ -208,6 +209,7 @@ resource "azurerm_automation_certificate" "test" {
automation_account_name = azurerm_automation_account.test.name
base64 = "%s"
description = "This is a test certificate for terraform acceptance test"
exportable = false
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, testCertBase64)
}
5 changes: 3 additions & 2 deletions website/docs/r/automation_certificate.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ resource "azurerm_automation_certificate" "example" {

description = "This is an example certificate"
base64 = filebase64("certificate.pfx")
exportable = true
}
```

Expand All @@ -50,14 +51,14 @@ The following arguments are supported:

* `description` - (Optional) The description of this Automation Certificate.

* `exportable` - (Optional) The is exportable flag of the certificate.

## Attributes Reference

The following attributes are exported:

* `id` - The Automation Certificate ID.

* `is_exportable` - The is exportable flag of the certificate.

* `thumbprint` - The thumbprint for the certificate.

## Timeouts
Expand Down