-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
data_source_key_vault, resource_arm_key_vault, resource_arm_automation_account, resource_arm_notification_hub_namespace, resource_arm_relay_namespace: Flatten SKU #3119
Merged
Merged
Changes from 27 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
ed02bc9
Flatten azurerm_automation_account sku
WodansSon 4376934
Flatten azurerm_key_vault sku
WodansSon 857900f
Flatten azurerm_notification_hub sku
WodansSon f0f0f7d
Flatten azurerm_relay_namespace sku
WodansSon 8e73fe9
Fix lint error
WodansSon d630381
Update for backward compatibility
WodansSon a68fd36
Updates for backwards compatibility
WodansSon 96cf7e3
Merge branch 'master' into e_flatten_sku
WodansSon 106e746
Update website/docs/r/automation_account.html.markdown
WodansSon 2764db9
Update website/docs/r/key_vault.html.markdown
WodansSon d15ee4c
Update website/docs/r/notification_hub_namespace.html.markdown
WodansSon 907f35e
Update website/docs/r/relay_namespace.html.markdown
WodansSon 2bd0c80
Addressed PR comments...
WodansSon 699cd49
Merge branch 'master' into e_flatten_sku
WodansSon a2f3528
Fix lint and build errors
WodansSon c9a9fae
Merge branch 'e_flatten_sku' of https://github.com/terraform-provider…
WodansSon f907f33
Fix CI\CD issues
WodansSon 9781279
Ran gofmt on files...
WodansSon c642cdc
Updates per PR
WodansSon 465a3ee
Update for PR
WodansSon c7cb43b
Fix lint error
WodansSon a406b85
Updated CreateUpdate for all resources
WodansSon 4bd21fa
Fixed relay.SkuName issue
WodansSon 7ac5cef
Fixed Travis Errors
WodansSon 0c8c18b
Update azurerm/resource_arm_relay_namespace.go
WodansSon 962aec1
Update azurerm/resource_arm_notification_hub_namespace.go
WodansSon d5e7a70
Set both Sku and Sku_Name in datasource
WodansSon c6ebd0f
Update azurerm/resource_arm_notification_hub_namespace_test.go
WodansSon 86bebe7
Update Key Vault Datasource and test case
WodansSon 832d630
Merge branch 'master' into e_flatten_sku
WodansSon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ func dataSourceArmKeyVault() *schema.Resource { | |
|
||
"location": azure.SchemaLocationForDataSource(), | ||
|
||
// Remove in 2.0 | ||
"sku": { | ||
Type: schema.TypeList, | ||
Computed: true, | ||
|
@@ -39,6 +40,11 @@ func dataSourceArmKeyVault() *schema.Resource { | |
}, | ||
}, | ||
|
||
"sku_name": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
}, | ||
|
||
"vault_uri": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
|
@@ -177,10 +183,15 @@ func dataSourceArmKeyVaultRead(d *schema.ResourceData, meta interface{}) error { | |
d.Set("enabled_for_template_deployment", props.EnabledForTemplateDeployment) | ||
d.Set("vault_uri", props.VaultURI) | ||
|
||
// Remove in 2.0 | ||
if err := d.Set("sku", flattenKeyVaultDataSourceSku(props.Sku)); err != nil { | ||
return fmt.Errorf("Error setting `sku` for KeyVault %q: %+v", *resp.Name, err) | ||
} | ||
|
||
if err := d.Set("sku_name", string(props.Sku.Name)); err != nil { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll need to check that props.Sku is not nil here:
|
||
return fmt.Errorf("Error setting `sku_name` for KeyVault %q: %+v", *resp.Name, err) | ||
} | ||
|
||
flattenedPolicies := azure.FlattenKeyVaultAccessPolicies(props.AccessPolicies) | ||
if err := d.Set("access_policy", flattenedPolicies); err != nil { | ||
return fmt.Errorf("Error setting `access_policy` for KeyVault %q: %+v", *resp.Name, err) | ||
|
@@ -196,6 +207,7 @@ func dataSourceArmKeyVaultRead(d *schema.ResourceData, meta interface{}) error { | |
return nil | ||
} | ||
|
||
// Remove in 2.0 | ||
func flattenKeyVaultDataSourceSku(sku *keyvault.Sku) []interface{} { | ||
result := map[string]interface{}{ | ||
"name": string(sku.Name), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we keep this in untill 2.0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not in the data source, since it is read only... when it writes to the state file it will persist the new attribute instead of the deprecated attribute to be consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However if someone is relying on this property currently it will break them in weird and wonderful ways with no deprecation notice. We should keep it around until 2.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As about we should be setting both
sku
andsku_name
here