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_shared_image - Support for purchase_plan #8124

Merged
merged 3 commits into from
Aug 20, 2020

Conversation

ArcturusZhang
Copy link
Contributor

Fixes #7962

Copy link
Member

@mbfrahry mbfrahry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes are nearly there! Just a few catches around ForceNew and some doc changes

@@ -344,3 +374,53 @@ func flattenGalleryImageIdentifier(input *compute.GalleryImageIdentifier) []inte
},
}
}

func expandGalleryImagePurchasePlan(input []interface{}) *compute.ImagePurchasePlan {
if len(input) == 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll want to check that input[0] doesn't equal nil as well so we don't panic

Suggested change
if len(input) == 0 {
if len(input) == 0 && input[0] != nil {

Copy link
Contributor Author

@ArcturusZhang ArcturusZhang Aug 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this should be

Suggested change
if len(input) == 0 {
if len(input) == 0 || input[0] == nil {

if we are doing a nil check here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And I suppose since the name attribute in this block is required, the situation input[0] == nil will never happen, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I still added this check for safety

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes! Thanks for catching that || instead of &&. We should check even if should never happen as a just in case.

website/docs/r/shared_image.html.markdown Outdated Show resolved Hide resolved
website/docs/r/shared_image.html.markdown Outdated Show resolved Hide resolved
website/docs/r/shared_image.html.markdown Outdated Show resolved Hide resolved
@ArcturusZhang
Copy link
Contributor Author

Hi @mbfrahry I have made some changes, please have a look, thanks!

Copy link
Member

@mbfrahry mbfrahry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mbfrahry mbfrahry changed the title Update azurerm_shared_image - Support purchase_plan azurerm_shared_image - Support purchase_plan Aug 20, 2020
@mbfrahry mbfrahry changed the title azurerm_shared_image - Support purchase_plan azurerm_shared_image - Support for purchase_plan Aug 20, 2020
@mbfrahry mbfrahry merged commit fc2a55c into hashicorp:master Aug 20, 2020
mbfrahry added a commit that referenced this pull request Aug 20, 2020
@ArcturusZhang ArcturusZhang deleted the plan-for-shared-image branch August 24, 2020 04:38
@ghost
Copy link

ghost commented Sep 20, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Sep 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for azurerm_shared_image for plan information
2 participants