Skip to content

Commit d0b2ba1

Browse files
committed
Remove obsolete policy
1 parent 35e8c7e commit d0b2ba1

File tree

3 files changed

+6
-50
lines changed

3 files changed

+6
-50
lines changed

management/policies.tf

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
resource "spacelift_policy" "ignore-outside-project-root" {
2-
name = "Ignore pushes outside of project root - ${random_string.stack_name_suffix.result}"
3-
body = file("${path.module}/policies/ignore-outside-project-root.rego")
4-
type = "GIT_PUSH"
5-
6-
labels = toset(var.spacelift_labels)
7-
}
8-
91
resource "spacelift_policy" "trigger-dependent-stacks" {
102
name = "Trigger dependent stacks - ${random_string.stack_name_suffix.result}"
113
body = file("${path.module}/policies/trigger-dependent-stacks.rego")

management/policies/ignore-outside-project-root.rego

Lines changed: 0 additions & 18 deletions
This file was deleted.

management/stacks.tf

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ resource "random_string" "stack_name_suffix" {
33
special = false
44
}
55

6+
data "spacelift_current_stack" "this" {}
7+
8+
data "spacelift_stack" "current_stack" {
9+
stack_id = data.spacelift_current_stack.this.id
10+
}
11+
612
# Terraform stack
713
resource "spacelift_stack" "terraform-ansible-workflow-terraform" {
814
branch = data.spacelift_stack.current_stack.branch
@@ -44,11 +50,6 @@ resource "spacelift_aws_role" "terraform-stack" {
4450
role_arn = var.aws_role
4551
}
4652

47-
resource "spacelift_policy_attachment" "ignore-outside-project-root-terraform" {
48-
policy_id = spacelift_policy.ignore-outside-project-root.id
49-
stack_id = spacelift_stack.terraform-ansible-workflow-terraform.id
50-
}
51-
5253
resource "spacelift_policy_attachment" "trigger-dependent-stacks-terraform" {
5354
policy_id = spacelift_policy.trigger-dependent-stacks.id
5455
stack_id = spacelift_stack.terraform-ansible-workflow-terraform.id
@@ -59,7 +60,6 @@ resource "spacelift_stack_destructor" "terraform-stack" {
5960
spacelift_environment_variable.ansible_context_id,
6061
spacelift_environment_variable.aws_region,
6162
spacelift_aws_role.terraform-stack,
62-
spacelift_policy_attachment.ignore-outside-project-root-terraform,
6363
spacelift_policy_attachment.trigger-dependent-stacks-terraform,
6464
]
6565

@@ -102,28 +102,11 @@ resource "spacelift_aws_role" "ansible-stack" {
102102
role_arn = var.aws_role
103103
}
104104

105-
resource "spacelift_policy_attachment" "ignore-outside-project-root-ansible" {
106-
policy_id = spacelift_policy.ignore-outside-project-root.id
107-
stack_id = spacelift_stack.terraform-ansible-workflow-ansible.id
108-
}
109-
110105
resource "spacelift_policy_attachment" "warn-on-unreachable-hosts-ansible" {
111106
policy_id = spacelift_policy.warn-on-unreachable-hosts.id
112107
stack_id = spacelift_stack.terraform-ansible-workflow-ansible.id
113108
}
114109

115-
# Ignore outside of project root for current stack
116-
data "spacelift_current_stack" "this" {}
117-
118-
data "spacelift_stack" "current_stack" {
119-
stack_id = data.spacelift_current_stack.this.id
120-
}
121-
122-
resource "spacelift_policy_attachment" "ignore-outside-project-root-this" {
123-
policy_id = spacelift_policy.ignore-outside-project-root.id
124-
stack_id = data.spacelift_current_stack.this.id
125-
}
126-
127110
# Trigger a run in terraform stack
128111

129112
resource "spacelift_run" "this" {
@@ -132,6 +115,5 @@ resource "spacelift_run" "this" {
132115
depends_on = [
133116
spacelift_environment_variable.ansible_context_id,
134117
spacelift_aws_role.ansible-stack,
135-
spacelift_policy_attachment.ignore-outside-project-root-ansible,
136118
]
137119
}

0 commit comments

Comments
 (0)