-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[Image] zone resilient property addition #3100
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1153a1d
zone resilient property addition
Lucretius b291f50
configure tests for ZRS flag
Lucretius 79f6b42
note where the region list came from
Lucretius 27e5dbf
fix list
Lucretius c0d06e9
PR fixes
Lucretius a9ae39f
add newline back
Lucretius 98c280e
Update azurerm/resource_arm_image_test.go
katbyte 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
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 |
---|---|---|
|
@@ -35,6 +35,13 @@ func resourceArmImage() *schema.Resource { | |
|
||
"resource_group_name": resourceGroupNameSchema(), | ||
|
||
"zone_resilient": { | ||
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. could we also Set this in the state here using the object returned from the API? https://github.com/terraform-providers/terraform-provider-azurerm/pull/3100/files#diff-95b4abb1c5040a8fd4f3c3674821b7b6R292 |
||
Type: schema.TypeBool, | ||
Optional: true, | ||
Default: false, | ||
ForceNew: true, | ||
}, | ||
|
||
"source_virtual_machine_id": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
|
@@ -166,6 +173,7 @@ func resourceArmImageCreateUpdate(d *schema.ResourceData, meta interface{}) erro | |
|
||
name := d.Get("name").(string) | ||
resGroup := d.Get("resource_group_name").(string) | ||
zoneResilient := d.Get("zone_resilient").(bool) | ||
|
||
if requireResourcesToBeImported && d.IsNewResource() { | ||
existing, err := client.Get(ctx, resGroup, name, "") | ||
|
@@ -196,8 +204,9 @@ func resourceArmImageCreateUpdate(d *schema.ResourceData, meta interface{}) erro | |
} | ||
|
||
storageProfile := compute.ImageStorageProfile{ | ||
OsDisk: osDisk, | ||
DataDisks: &dataDisks, | ||
OsDisk: osDisk, | ||
DataDisks: &dataDisks, | ||
ZoneResilient: utils.Bool(zoneResilient), | ||
} | ||
|
||
sourceVM := compute.SubResource{} | ||
|
@@ -295,6 +304,7 @@ func resourceArmImageRead(d *schema.ResourceData, meta interface{}) error { | |
return fmt.Errorf("[DEBUG] Error setting AzureRM Image Data Disks error: %+v", err) | ||
} | ||
} | ||
d.Set("zone_resilient", resp.StorageProfile.ZoneResilient) | ||
} | ||
|
||
flattenAndSetTags(d, resp.Tags) | ||
|
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
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
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
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
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
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.
could we set this field in the state here: https://github.com/terraform-providers/terraform-provider-azurerm/pull/3100/files#diff-21521ec4fe0d38353d87860312cd25a4R187
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.
Good catch thanks!