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

automation_account - add public_network_access_enabled #15429

Merged

Conversation

shu-ying789
Copy link
Contributor

account7

@shu-ying789 shu-ying789 changed the title automation_account - add test for public_network_access_enabled automation_account - add public_network_access_enabled Feb 15, 2022
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.

Hey @shu-ying789. Thanks for opening this PR! Unfortunately, this is a breaking change as Terraform wants to update the existing resource with this new attribute as seen here

      ~ public_network_access_enabled = false -> true

I've detailed how to get around this in the comments

@@ -187,7 +192,7 @@ func resourceAutomationAccountRead(d *pluginsdk.ResourceData, meta interface{})
d.Set("name", id.Name)
d.Set("resource_group_name", id.ResourceGroup)
d.Set("location", location.NormalizeNilable(resp.Location))

d.Set("public_network_access_enabled", resp.PublicNetworkAccess)
Copy link
Member

Choose a reason for hiding this comment

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

resp.PublicNetworkAccess isn't returned from the API if it wasn't passed to the API on creation so we get a state change even though it is enabled in the portal. My suggestion is that we always make sure to set public_network_access_enabled to true even if that attribute isn't returned from the API

Suggested change
d.Set("public_network_access_enabled", resp.PublicNetworkAccess)
publicNetworkAccessEnabled := true
if resp.PublicNetworkAccess != nil {
publicNetworkAccessEnabled = *resp.PublicNetworkAccess
}
d.Set("public_network_access_enabled", publicNetworkAccessEnabled)

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 added this to the v2.97.0 milestone Feb 16, 2022
@mbfrahry mbfrahry merged commit 591187e into hashicorp:main Feb 16, 2022
mbfrahry added a commit that referenced this pull request Feb 16, 2022
@github-actions
Copy link

This functionality has been released in v2.97.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2022
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.

2 participants