Я использую Terraform Enterprise,
Я создал файл main.tf и поместил приведенный ниже код для создания политики дозорного
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"
}
Затем, когда я запустил применение Terraform, План успешен, но применить не удается с приведенным ниже сообщением об ошибке.
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" {