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

New Resource: azurerm_policy_assignment #1051

Merged
merged 3 commits into from
Mar 30, 2018
Merged

Conversation

tombuildsstuff
Copy link
Contributor

@tombuildsstuff tombuildsstuff commented Mar 30, 2018

$ acctests azurerm TestAccAzureRMPolicyAssignment_
=== RUN   TestAccAzureRMPolicyAssignment_basic
--- PASS: TestAccAzureRMPolicyAssignment_basic (262.01s)
=== RUN   TestAccAzureRMPolicyAssignment_complete
--- PASS: TestAccAzureRMPolicyAssignment_complete (257.42s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	519.467s

Fixes #46

```
$ acctests azurerm TestAccAzureRMPolicyAssignment_
=== RUN   TestAccAzureRMPolicyAssignment_basic
--- PASS: TestAccAzureRMPolicyAssignment_basic (262.01s)
=== RUN   TestAccAzureRMPolicyAssignment_complete
--- PASS: TestAccAzureRMPolicyAssignment_complete (257.42s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	519.467s
```
```
$ acctests azurerm TestAccAzureRMPolicyDefinition_
=== RUN   TestAccAzureRMPolicyDefinition_importBasic
--- PASS: TestAccAzureRMPolicyDefinition_importBasic (116.69s)
=== RUN   TestAccAzureRMPolicyDefinition_basic
--- PASS: TestAccAzureRMPolicyDefinition_basic (112.03s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	228.755s
```
@tombuildsstuff
Copy link
Contributor Author

Policy Definitions tests pass:

$ acctests azurerm TestAccAzureRMPolicyDefinition_
=== RUN   TestAccAzureRMPolicyDefinition_importBasic
--- PASS: TestAccAzureRMPolicyDefinition_importBasic (116.69s)
=== RUN   TestAccAzureRMPolicyDefinition_basic
--- PASS: TestAccAzureRMPolicyDefinition_basic (112.03s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	228.755s

```
$ acctests azurerm TestAccAzureRMPolicyAssignment_importComplete
=== RUN   TestAccAzureRMPolicyAssignment_importComplete
--- PASS: TestAccAzureRMPolicyAssignment_importComplete (300.40s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	300.433s
```
@tombuildsstuff
Copy link
Contributor Author

Import tests pass:

$ acctests azurerm TestAccAzureRMPolicyAssignment_importComplete
=== RUN   TestAccAzureRMPolicyAssignment_importComplete
--- PASS: TestAccAzureRMPolicyAssignment_importComplete (300.40s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	300.433s

Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

👍 Looks good.

@tombuildsstuff tombuildsstuff merged commit 23e7147 into master Mar 30, 2018
@tombuildsstuff tombuildsstuff deleted the policy-assignments branch March 30, 2018 20:49
tombuildsstuff added a commit that referenced this pull request Mar 30, 2018
@JamesDLD
Copy link

JamesDLD commented Jun 6, 2018

Thanks for this usefull resource.
Could you please update the documentation : https://www.terraform.io/docs/providers/azurerm/r/policy_assignment.html

By replacing this sentence

scope- (Required) The Scope at which the Policy Assignment should be applied. This can either be the Subscription (e.g. /subscriptions/00000000-0000-0000-000000000000) or a Resource Group (e.g./subscriptions/00000000-0000-0000-000000000000/resourceGroups/myResourceGroup). Changing this forces a new resource to be created.

By

scope- (Required) The Scope at which the Policy Assignment should be applied. This can either be the Subscription (e.g. /subscriptions/00000000-0000-0000-000000000000) or a Resource Group (e.g./subscriptions/00000000-0000-0000-000000000000/resourceGroups/myResourceGroup) or a Resource (e.g./subscriptions/00000000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVirutalNetwork). Changing this forces a new resource to be created.

@katbyte
Copy link
Collaborator

katbyte commented Jun 10, 2018

Hello @JamesDLD,

Do you have a reference for this information? In the portal I can only select a subscription or resource group and a quick google doesn't find anything.

Thanks!

@JamesDLD
Copy link

Hello @katbyte
of course you can find the powershell associated page for example : https://docs.microsoft.com/en-us/powershell/module/azurerm.resources/new-azurermpolicyassignment?view=azurermps-6.2.0

The First samples shows how to assign a policy to a Resource type : Resource Group.

Here I did it on several objects like : Resource Group, Virtual Network, Recovery Services Vault : https://github.com/JamesDLD/terraform

@tombuildsstuff
Copy link
Contributor Author

@katbyte @JamesDLD in this case I'd suggest we say Resource ID rather than giving an example of a Resource ID as these can be case-sensitive within Azure (which is why we use Data Sources rather than hard-coding ID's in examples, where at all possible).

@JamesDLD would you mind opening a new issue specifically for this? Thanks! :)

@JamesDLD
Copy link

Look great to me @tombuildsstuff @katbyte , just did create this ticket #1420 accordingly.

@ghost
Copy link

ghost commented Mar 30, 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 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 30, 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.

Feature Request: Resource Policy Resource
4 participants