I'm using terraform enterprise,
I created main.tf file and placed the below code for creating sentinel policy
data "tfe_workspace_ids" "all" {
names = ["*"]
organization = myorg
}
locals {
workspaces = "${data.tfe_workspace_ids.all.external_ids}" # map of names to IDs
}
resource "tfe_sentinel_policy" "test" {
name = "my-policy-name"
description = "This policy always passes"
organization = "myorg"
policy = "main = rule { true }"
enforce_mode = "hard-mandatory"
}
Then, when I run the terraform apply, the plan is success but apply fails with the below error message.
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# tfe_sentinel_policy.test will be created
+ resource "tfe_sentinel_policy" "test" {
+ description = "This policy always passes"
+ enforce_mode = "hard-mandatory"
+ id = (known after apply)
+ name = "my-policy-name"
+ organization = "myorg"
+ policy = "main = rule { true }"
}
Plan: 1 to add, 0 to change, 0 to destroy.
Do you want to perform these actions in workspace "tf-sentinel-governance"?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
tfe_sentinel_policy.test: Creating...
Error: Error creating sentinel policy my-policy-name for organization myorg: resource not found
on main.tf line 10, in resource "tfe_sentinel_policy" "test":
10: resource "tfe_sentinel_policy" "test" {