-
Notifications
You must be signed in to change notification settings - Fork 927
Closed
Labels
Status: Up for grabsIssues that are ready to be worked on by anyoneIssues that are ready to be worked on by anyoneType: BugSomething isn't working as documentedSomething isn't working as documented
Milestone
Description
Expected Behavior
After import and terraform plan, should see
No changes. Your infrastructure matches the configuration.
Actual Behavior
- terraform plan
# github_repository_environment_deployment_policy.feature must be replaced
-/+ resource "github_repository_environment_deployment_policy" "feature" {
+ environment = "dly" # forces replacement
~ id = "xxx-recs-event-streaming:dly:1212XXXX" -> (known after apply)
+ repository = "xxx-recs-event-streaming" # forces replacement
# (1 unchanged attribute hidden)
}
Terraform Version
$ terragrunt version
Terraform v1.6.2
on linux_amd64
- provider registry.terraform.io/hashicorp/azuread v2.35.0
- provider registry.terraform.io/hashicorp/azurerm v3.50.0
- provider registry.terraform.io/integrations/github v5.42.0
Affected Resource(s)
- github_repository_environment_deployment_policy
Terraform Configuration Files
resource github_repository_environment env {
environment = var.env
repository = var.repository.name
deployment_branch_policy {
protected_branches = true
custom_branch_policies = true
}
}
resource "github_repository_environment_deployment_policy" "feature" {
repository = data.github_repository.xxxx.name
environment = github_actions_environment.env.environment
branch_pattern = "feature/**"
}Steps to Reproduce
- Create an environment
- Add a deployment policy via the portal
- Define the policy in configuration:
- Import the policy
$ tg import github_repository_environment_deployment_policy.feature xxx-recs-event-streaming:dly:1212XXXX
- Examining the state -- note the nulls
{
"mode": "managed",
"type": "github_repository_environment_deployment_policy",
"name": "master",
"provider": "provider[\"registry.terraform.io/integrations/github\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"branch_pattern": "master",
"environment": null, <<<<< BAD
"id": "xxx-recs-event-streaming:dly:1212XXXX",
"repository": null <<<<<< BAD
},
"sensitive_attributes": [],
"private": "xxxxxxx=="
}
]
},
- workaround: patch the state directly and push the fixed state:
{
"mode": "managed",
"type": "github_repository_environment_deployment_policy",
"name": "master",
"provider": "provider[\"registry.terraform.io/integrations/github\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"branch_pattern": "master",
"environment": "dly",
"id": "xxx-recs-event-streaming:dly:1212XXXX",
"repository": "xxx-recs-event-streaming"
},
"sensitive_attributes": [],
"private": "XXXXX=="
}
]
},
- now a plan....
...
github_repository_environment_deployment_policy.master: Refreshing state... [id=xxx-recs-event-streaming:dly:1212XXXX]
...
data.azurerm_subscription.current: Read complete after 0s [id=/subscriptions/XXXX]
No changes. Your infrastructure matches the configuration.
Debug Output
No response
Panic Output
No response
Code of Conduct
- I agree to follow this project's Code of Conduct
alexanderogorodnikov, jcahigal, mw-root and ricky26j
Metadata
Metadata
Assignees
Labels
Status: Up for grabsIssues that are ready to be worked on by anyoneIssues that are ready to be worked on by anyoneType: BugSomething isn't working as documentedSomething isn't working as documented