diff --git a/docs/resources/organization.md b/docs/resources/organization.md index e17b15801..e4f7dfda1 100644 --- a/docs/resources/organization.md +++ b/docs/resources/organization.md @@ -46,8 +46,8 @@ resource "ec_organization" "my_org" { deployment_roles = [ # A role can be given for all deployments { - role = "editor" - for_all_deployments = true + role = "editor" + all_deployments = true }, # Or just for specific deployments @@ -61,8 +61,8 @@ resource "ec_organization" "my_org" { project_elasticsearch_roles = [ # A role can be given for all projects { - role = "admin" - for_all_projects = true + role = "admin" + all_projects = true }, # Or just for specific projects @@ -94,8 +94,8 @@ locals { deployment_admin = { deployment_roles = [ { - role = "admin" - for_all_deployments = true + role = "admin" + all_deployments = true } ] } @@ -103,8 +103,8 @@ locals { deployment_viewer = { deployment_roles = [ { - role = "viewer" - for_all_deployments = true + role = "viewer" + all_deployments = true } ] } diff --git a/ec/ecresource/organizationresource/resource_test.go b/ec/ecresource/organizationresource/resource_test.go index 06a265763..1aab3c652 100644 --- a/ec/ecresource/organizationresource/resource_test.go +++ b/ec/ecresource/organizationresource/resource_test.go @@ -73,25 +73,25 @@ func TestOrganizationResourceAgainstMockedAPI(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "members.user@example.com.deployment_roles.0.role", "editor"), resource.TestCheckResourceAttr(resourceName, "members.user@example.com.deployment_roles.0.deployment_ids.0", "abc"), resource.TestCheckResourceAttr(resourceName, "members.user@example.com.deployment_roles.1.role", "viewer"), - resource.TestCheckResourceAttr(resourceName, "members.user@example.com.deployment_roles.1.for_all_deployments", "true"), + resource.TestCheckResourceAttr(resourceName, "members.user@example.com.deployment_roles.1.all_deployments", "true"), // Elasticsearch roles resource.TestCheckResourceAttr(resourceName, "members.user@example.com.project_elasticsearch_roles.0.role", "developer"), resource.TestCheckResourceAttr(resourceName, "members.user@example.com.project_elasticsearch_roles.0.project_ids.0", "qwe"), resource.TestCheckResourceAttr(resourceName, "members.user@example.com.project_elasticsearch_roles.1.role", "viewer"), - resource.TestCheckResourceAttr(resourceName, "members.user@example.com.project_elasticsearch_roles.1.for_all_projects", "true"), + resource.TestCheckResourceAttr(resourceName, "members.user@example.com.project_elasticsearch_roles.1.all_projects", "true"), // Observability roles resource.TestCheckResourceAttr(resourceName, "members.user@example.com.project_observability_roles.0.role", "editor"), resource.TestCheckResourceAttr(resourceName, "members.user@example.com.project_observability_roles.0.project_ids.0", "rty"), resource.TestCheckResourceAttr(resourceName, "members.user@example.com.project_observability_roles.1.role", "viewer"), - resource.TestCheckResourceAttr(resourceName, "members.user@example.com.project_observability_roles.1.for_all_projects", "true"), + resource.TestCheckResourceAttr(resourceName, "members.user@example.com.project_observability_roles.1.all_projects", "true"), // Project roles resource.TestCheckResourceAttr(resourceName, "members.user@example.com.project_security_roles.0.role", "editor"), resource.TestCheckResourceAttr(resourceName, "members.user@example.com.project_security_roles.0.project_ids.0", "uio"), resource.TestCheckResourceAttr(resourceName, "members.user@example.com.project_security_roles.1.role", "viewer"), - resource.TestCheckResourceAttr(resourceName, "members.user@example.com.project_security_roles.1.for_all_projects", "true"), + resource.TestCheckResourceAttr(resourceName, "members.user@example.com.project_security_roles.1.all_projects", "true"), ), }, // A newly added member should be invited to the organization @@ -138,7 +138,7 @@ func TestOrganizationResourceAgainstMockedAPI(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "members.newuser@example.com.deployment_roles.0.role", "editor"), resource.TestCheckResourceAttr(resourceName, "members.newuser@example.com.deployment_roles.0.deployment_ids.0", "abc"), resource.TestCheckResourceAttr(resourceName, "members.newuser@example.com.deployment_roles.1.role", "viewer"), - resource.TestCheckResourceAttr(resourceName, "members.newuser@example.com.deployment_roles.1.for_all_deployments", "true"), + resource.TestCheckResourceAttr(resourceName, "members.newuser@example.com.deployment_roles.1.all_deployments", "true"), ), }, // Removing roles from member @@ -149,7 +149,7 @@ func TestOrganizationResourceAgainstMockedAPI(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "members.newuser@example.com.email", "newuser@example.com"), resource.TestCheckNoResourceAttr(resourceName, "members.newuser@example.com.organization_role"), resource.TestCheckResourceAttr(resourceName, "members.newuser@example.com.deployment_roles.0.role", "viewer"), - resource.TestCheckResourceAttr(resourceName, "members.newuser@example.com.deployment_roles.0.for_all_deployments", "true"), + resource.TestCheckResourceAttr(resourceName, "members.newuser@example.com.deployment_roles.0.all_deployments", "true"), ), }, // Removing member from organization @@ -550,7 +550,7 @@ resource "ec_organization" "myorg" { deployment_roles = [ { role = "viewer" - for_all_deployments = true + all_deployments = true }, { role = "editor" @@ -561,7 +561,7 @@ resource "ec_organization" "myorg" { project_elasticsearch_roles = [ { role = "viewer" - for_all_projects = true + all_projects = true }, { role = "developer" @@ -572,7 +572,7 @@ resource "ec_organization" "myorg" { project_observability_roles = [ { role = "viewer" - for_all_projects = true + all_projects = true }, { role = "editor" @@ -583,7 +583,7 @@ resource "ec_organization" "myorg" { project_security_roles = [ { role = "viewer" - for_all_projects = true + all_projects = true }, { role = "editor" @@ -616,7 +616,7 @@ const memberWithNewRoles = ` deployment_roles = [ { role = "viewer" - for_all_deployments = true + all_deployments = true }, { role = "editor" @@ -631,7 +631,7 @@ const memberWithRemovedRoles = ` deployment_roles = [ { role = "viewer" - for_all_deployments = true + all_deployments = true } ] } diff --git a/ec/ecresource/organizationresource/schema.go b/ec/ecresource/organizationresource/schema.go index e85b835d9..657a3534b 100644 --- a/ec/ecresource/organizationresource/schema.go +++ b/ec/ecresource/organizationresource/schema.go @@ -50,14 +50,14 @@ type OrganizationMember struct { type DeploymentRoleAssignment struct { Role types.String `tfsdk:"role"` - ForAllDeployments types.Bool `tfsdk:"for_all_deployments"` + ForAllDeployments types.Bool `tfsdk:"all_deployments"` DeploymentIDs types.Set `tfsdk:"deployment_ids"` ApplicationRoles types.Set `tfsdk:"application_roles"` } type ProjectRoleAssignment struct { Role types.String `tfsdk:"role"` - ForAllProjects types.Bool `tfsdk:"for_all_projects"` + ForAllProjects types.Bool `tfsdk:"all_projects"` ProjectIDs types.Set `tfsdk:"project_ids"` ApplicationRoles types.Set `tfsdk:"application_roles"` } @@ -130,7 +130,7 @@ func deploymentRoleAssignmentsSchema() schema.SetNestedAttribute { MarkdownDescription: "Assigned role. Must be on of `viewer`, `editor` or `admin`.", Required: true, }, - "for_all_deployments": schema.BoolAttribute{ + "all_deployments": schema.BoolAttribute{ MarkdownDescription: "Role applies to all deployments in the organization.", Optional: true, PlanModifiers: []planmodifier.Bool{ @@ -220,15 +220,15 @@ func projectRoleAssignmentSchema(roles []string) schema.NestedAttributeObject { MarkdownDescription: fmt.Sprintf("Assigned role. (Allowed values: %s)", "`"+strings.Join(roles, "`, `")+"`"), Required: true, }, - "for_all_projects": schema.BoolAttribute{ - MarkdownDescription: "Role applies to all deployments in the organization.", + "all_projects": schema.BoolAttribute{ + MarkdownDescription: "Role applies to all projects in the organization.", Optional: true, PlanModifiers: []planmodifier.Bool{ planmodifiers.BoolDefaultValue(false), // consider unknown as false }, }, "project_ids": schema.SetAttribute{ - MarkdownDescription: "Role applies to deployments listed here.", + MarkdownDescription: "Role applies to projects listed here.", Optional: true, ElementType: types.StringType, }, diff --git a/examples/resources/ec_organization/basic.tf b/examples/resources/ec_organization/basic.tf index 3c91674f0..279191208 100644 --- a/examples/resources/ec_organization/basic.tf +++ b/examples/resources/ec_organization/basic.tf @@ -12,8 +12,8 @@ resource "ec_organization" "my_org" { deployment_roles = [ # A role can be given for all deployments { - role = "editor" - for_all_deployments = true + role = "editor" + all_deployments = true }, # Or just for specific deployments @@ -27,8 +27,8 @@ resource "ec_organization" "my_org" { project_elasticsearch_roles = [ # A role can be given for all projects { - role = "admin" - for_all_projects = true + role = "admin" + all_projects = true }, # Or just for specific projects diff --git a/examples/resources/ec_organization/locals.tf b/examples/resources/ec_organization/locals.tf index 9c298905a..eff4984c9 100644 --- a/examples/resources/ec_organization/locals.tf +++ b/examples/resources/ec_organization/locals.tf @@ -3,8 +3,8 @@ locals { deployment_admin = { deployment_roles = [ { - role = "admin" - for_all_deployments = true + role = "admin" + all_deployments = true } ] } @@ -12,8 +12,8 @@ locals { deployment_viewer = { deployment_roles = [ { - role = "viewer" - for_all_deployments = true + role = "viewer" + all_deployments = true } ] }