Describe the bug
I try to import pre-defined roles into terraform, for example Viewer
import {
id = "Viewer"
to = platform_global_role.viewer
}
resource "platform_global_role" "viewer" {
name = "Viewer"
description = "Viewer Role"
type = "PREDEFINED"
environments = ["DEV"]
actions = [
"READ_APPLICATION",
"READ_APPLICATION_VERSION",
"READ_APPTRUST_POLICY",
"READ_BUILD",
"READ_INTEGRATIONS_PIPELINE",
"READ_POOLS_PIPELINE",
"READ_RELEASE_BUNDLE",
"READ_REPOSITORY",
"READ_SOURCES_PIPELINE",
]
}
The list of actions is taken from the list, which terraform shows as change, when one try to set an empty list (e.g. actions = []). The error
$ terraform plan -target=platform_global_role.viewer
╷
│ Error: Invalid Attribute Value Match
│
│ with platform_global_role.viewer,
│ on predefined.tf line 81, in resource "platform_global_role" "viewer":
│ 81: actions = [
│ 82: "READ_APPLICATION",
│ 83: "READ_APPLICATION_VERSION",
│ 84: "READ_APPTRUST_POLICY",
│ 85: "READ_BUILD",
│ 86: "READ_INTEGRATIONS_PIPELINE",
│ 87: "READ_POOLS_PIPELINE",
│ 88: "READ_RELEASE_BUNDLE",
│ 89: "READ_REPOSITORY",
│ 90: "READ_SOURCES_PIPELINE",
│ 91: ]
│
│ Attribute actions[Value("READ_APPLICATION")] value must be one of: ["READ_REPOSITORY" "ANNOTATE_REPOSITORY" "DEPLOY_CACHE_REPOSITORY" "DELETE_OVERWRITE_REPOSITORY"
│ "MANAGE_XRAY_MD_REPOSITORY" "READ_RELEASE_BUNDLE" "ANNOTATE_RELEASE_BUNDLE" "CREATE_RELEASE_BUNDLE" "DISTRIBUTE_RELEASE_BUNDLE" "DELETE_RELEASE_BUNDLE" "MANAGE_XRAY_MD_RELEASE_BUNDLE"
│ "READ_BUILD" "ANNOTATE_BUILD" "DEPLOY_BUILD" "DELETE_BUILD" "MANAGE_XRAY_MD_BUILD" "READ_SOURCES_PIPELINE" "TRIGGER_PIPELINE" "READ_INTEGRATIONS_PIPELINE" "READ_POOLS_PIPELINE"
│ "REPORTS_SECURITY" "WATCHES_SECURITY" "POLICIES_SECURITY" "RULES_SECURITY" "READ_POLICIES_SECURITY"], got: "READ_APPLICATION"
╵
╷
│ Error: Invalid Attribute Value Match
│
│ with platform_global_role.viewer,
│ on predefined.tf line 81, in resource "platform_global_role" "viewer":
│ 81: actions = [
│ 82: "READ_APPLICATION",
│ 83: "READ_APPLICATION_VERSION",
│ 84: "READ_APPTRUST_POLICY",
│ 85: "READ_BUILD",
│ 86: "READ_INTEGRATIONS_PIPELINE",
│ 87: "READ_POOLS_PIPELINE",
│ 88: "READ_RELEASE_BUNDLE",
│ 89: "READ_REPOSITORY",
│ 90: "READ_SOURCES_PIPELINE",
│ 91: ]
│
│ Attribute actions[Value("READ_APPLICATION_VERSION")] value must be one of: ["READ_REPOSITORY" "ANNOTATE_REPOSITORY" "DEPLOY_CACHE_REPOSITORY" "DELETE_OVERWRITE_REPOSITORY"
│ "MANAGE_XRAY_MD_REPOSITORY" "READ_RELEASE_BUNDLE" "ANNOTATE_RELEASE_BUNDLE" "CREATE_RELEASE_BUNDLE" "DISTRIBUTE_RELEASE_BUNDLE" "DELETE_RELEASE_BUNDLE" "MANAGE_XRAY_MD_RELEASE_BUNDLE"
│ "READ_BUILD" "ANNOTATE_BUILD" "DEPLOY_BUILD" "DELETE_BUILD" "MANAGE_XRAY_MD_BUILD" "READ_SOURCES_PIPELINE" "TRIGGER_PIPELINE" "READ_INTEGRATIONS_PIPELINE" "READ_POOLS_PIPELINE"
│ "REPORTS_SECURITY" "WATCHES_SECURITY" "POLICIES_SECURITY" "RULES_SECURITY" "READ_POLICIES_SECURITY"], got: "READ_APPLICATION_VERSION"
╵
╷
│ Error: Invalid Attribute Value Match
│
│ with platform_global_role.viewer,
│ on predefined.tf line 81, in resource "platform_global_role" "viewer":
│ 81: actions = [
│ 82: "READ_APPLICATION",
│ 83: "READ_APPLICATION_VERSION",
│ 84: "READ_APPTRUST_POLICY",
│ 85: "READ_BUILD",
│ 86: "READ_INTEGRATIONS_PIPELINE",
│ 87: "READ_POOLS_PIPELINE",
│ 88: "READ_RELEASE_BUNDLE",
│ 89: "READ_REPOSITORY",
│ 90: "READ_SOURCES_PIPELINE",
│ 91: ]
│
│ Attribute actions[Value("READ_APPTRUST_POLICY")] value must be one of: ["READ_REPOSITORY" "ANNOTATE_REPOSITORY" "DEPLOY_CACHE_REPOSITORY" "DELETE_OVERWRITE_REPOSITORY"
│ "MANAGE_XRAY_MD_REPOSITORY" "READ_RELEASE_BUNDLE" "ANNOTATE_RELEASE_BUNDLE" "CREATE_RELEASE_BUNDLE" "DISTRIBUTE_RELEASE_BUNDLE" "DELETE_RELEASE_BUNDLE" "MANAGE_XRAY_MD_RELEASE_BUNDLE"
│ "READ_BUILD" "ANNOTATE_BUILD" "DEPLOY_BUILD" "DELETE_BUILD" "MANAGE_XRAY_MD_BUILD" "READ_SOURCES_PIPELINE" "TRIGGER_PIPELINE" "READ_INTEGRATIONS_PIPELINE" "READ_POOLS_PIPELINE"
│ "REPORTS_SECURITY" "WATCHES_SECURITY" "POLICIES_SECURITY" "RULES_SECURITY" "READ_POLICIES_SECURITY"], got: "READ_APPTRUST_POLICY"
When you outcomment the actions, which the providers claims they dont exists, terraform likes to remove them from the global role
import {
id = "Viewer"
to = platform_global_role.viewer
}
resource "platform_global_role" "viewer" {
name = "Viewer"
description = "Viewer Role"
type = "PREDEFINED"
environments = ["DEV"]
actions = [
#"READ_APPLICATION", # <---
#"READ_APPLICATION_VERSION", # <---
#"READ_APPTRUST_POLICY", # <---
"READ_BUILD",
"READ_INTEGRATIONS_PIPELINE",
"READ_POOLS_PIPELINE",
"READ_RELEASE_BUNDLE",
"READ_REPOSITORY",
"READ_SOURCES_PIPELINE",
]
}
terraform plan -target=platform_global_role.viewer
platform_global_role.viewer: Preparing import... [id=Viewer]
platform_global_role.viewer: Refreshing state... [name=Viewer]
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# platform_global_role.viewer will be updated in-place
# (imported from "Viewer")
~ resource "platform_global_role" "viewer" {
~ actions = [
- "READ_APPLICATION",
- "READ_APPLICATION_VERSION",
- "READ_APPTRUST_POLICY",
"READ_BUILD",
"READ_INTEGRATIONS_PIPELINE",
"READ_POOLS_PIPELINE",
"READ_RELEASE_BUNDLE",
"READ_REPOSITORY",
"READ_SOURCES_PIPELINE",
]
description = "Viewer Role"
environments = [
"DEV",
]
name = "Viewer"
type = "PREDEFINED"
}
Plan: 1 to import, 0 to add, 1 to change, 0 to destroy.
Requirements for and issue
Expected behavior
It should be possible to import global roles into terraform with the complete list of actions
Describe the bug
I try to import pre-defined roles into terraform, for example
ViewerThe list of actions is taken from the list, which terraform shows as change, when one try to set an empty list (e.g.
actions = []). The errorWhen you outcomment the actions, which the providers claims they dont exists, terraform likes to remove them from the global role
Requirements for and issue
curlit at$host/artifactory/api/system/version)Expected behavior
It should be possible to import global roles into terraform with the complete list of actions