Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FFM-9404: harness_platform_feature_flag cannot add targeting rules #699

Merged
merged 3 commits into from
Sep 20, 2023

Conversation

ribeirophillipe
Copy link
Contributor

@ribeirophillipe ribeirophillipe commented Sep 18, 2023

Describe your changes

With this change, it is now possible to assign targets and target groups to feature flags on creation. Updates are still limited to the issue in FFM-9600, however, previously we failed to create rules due to an issue in the schema. This change fixes the schema for rules configuration during feature flag creation.

The test cases for this change include:

  • Create flag
  • add rules to flag
  • create flag with rules
  • remove rule

Comment Triggers

PR Check triggers
  • Build: trigger build
  • Sub Category Field Check: trigger subcategoryfieldcheck
  • gitleaks: trigger gitleaks

@rssnyder
Copy link
Contributor

rssnyder commented Sep 19, 2023

I took my flag resource that was working before (working as in the flag was created, but the targeting rules were not working) and I am getting an error when now trying to create the flag with this patch.

tf debug logs ```details 2023-09-19T07:47:49.970-0500 [INFO] Terraform version: 1.4.6 2023-09-19T07:47:49.971-0500 [DEBUG] using github.com/hashicorp/go-tfe v1.21.0 2023-09-19T07:47:49.971-0500 [DEBUG] using github.com/hashicorp/hcl/v2 v2.16.2 2023-09-19T07:47:49.971-0500 [DEBUG] using github.com/hashicorp/terraform-config-inspect v0.0.0-20210209133302-4fd17a0faac2 2023-09-19T07:47:49.971-0500 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.0 2023-09-19T07:47:49.971-0500 [DEBUG] using github.com/zclconf/go-cty v1.12.1 2023-09-19T07:47:49.971-0500 [INFO] Go runtime version: go1.19.6 2023-09-19T07:47:49.971-0500 [INFO] CLI args: []string{"/opt/homebrew/Cellar/tfenv/3.0.0/versions/1.4.6/terraform", "apply"} 2023-09-19T07:47:49.971-0500 [DEBUG] Attempting to open CLI config file: /Users/rileysnyder/.terraformrc 2023-09-19T07:47:49.971-0500 [INFO] Loading CLI configuration from /Users/rileysnyder/.terraformrc 2023-09-19T07:47:49.971-0500 [DEBUG] checking for credentials in "/Users/rileysnyder/.terraform.d/plugins" 2023-09-19T07:47:49.971-0500 [DEBUG] Explicit provider installation configuration is set 2023-09-19T07:47:49.972-0500 [INFO] CLI command args: []string{"apply"} 2023-09-19T07:47:49.973-0500 [DEBUG] New state was assigned lineage "42ab36b3-9471-13d6-02b2-f6e374c4ce6f" 2023-09-19T07:47:49.973-0500 [DEBUG] Provider registry.terraform.io/harness/harness is overridden by dev_overrides 2023-09-19T07:47:49.973-0500 [DEBUG] Provider registry.terraform.io/harness/harness is overridden to load from /Users/rileysnyder/git/terraform-provider-harness 2023-09-19T07:47:49.973-0500 [DEBUG] checking for provisioner in "." 2023-09-19T07:47:49.973-0500 [DEBUG] checking for provisioner in "/opt/homebrew/Cellar/tfenv/3.0.0/versions/1.4.6" 2023-09-19T07:47:49.973-0500 [DEBUG] checking for provisioner in "/Users/rileysnyder/.terraform.d/plugins" 2023-09-19T07:47:49.973-0500 [DEBUG] Provider registry.terraform.io/harness/harness is overridden by dev_overrides ╷ │ Warning: Provider development overrides are in effect │ │ The following provider development overrides are set in the CLI configuration: │ - harness/harness in /Users/rileysnyder/git/terraform-provider-harness │ │ The behavior may therefore not match any released version of the provider and applying changes may cause the state to become incompatible with published releases. ╵ 2023-09-19T07:47:49.974-0500 [INFO] backend/local: starting Apply operation 2023-09-19T07:47:49.977-0500 [DEBUG] Config.VerifyDependencySelections: skipping registry.terraform.io/harness/harness because it's overridden by a special configuration setting 2023-09-19T07:47:49.978-0500 [DEBUG] created provider logger: level=debug 2023-09-19T07:47:49.978-0500 [INFO] provider: configuring client automatic mTLS 2023-09-19T07:47:49.988-0500 [DEBUG] provider: starting plugin: path=/Users/rileysnyder/git/terraform-provider-harness/terraform-provider-harness_v0.0.1 args=[/Users/rileysnyder/git/terraform-provider-harness/terraform-provider-harness_v0.0.1] 2023-09-19T07:47:49.991-0500 [DEBUG] provider: plugin started: path=/Users/rileysnyder/git/terraform-provider-harness/terraform-provider-harness_v0.0.1 pid=54131 2023-09-19T07:47:49.991-0500 [DEBUG] provider: waiting for RPC address: path=/Users/rileysnyder/git/terraform-provider-harness/terraform-provider-harness_v0.0.1 2023-09-19T07:47:50.001-0500 [INFO] provider.terraform-provider-harness_v0.0.1: configuring server automatic mTLS: timestamp=2023-09-19T07:47:50.001-0500 2023-09-19T07:47:50.013-0500 [DEBUG] provider: using plugin: version=5 2023-09-19T07:47:50.013-0500 [DEBUG] provider.terraform-provider-harness_v0.0.1: plugin address: address=/var/folders/54/4rq2vpp528scs1vqrd8485rh0000gp/T/plugin340928087 network=unix timestamp=2023-09-19T07:47:50.013-0500 2023-09-19T07:47:50.037-0500 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF" 2023-09-19T07:47:50.038-0500 [DEBUG] provider: plugin process exited: path=/Users/rileysnyder/git/terraform-provider-harness/terraform-provider-harness_v0.0.1 pid=54131 2023-09-19T07:47:50.038-0500 [DEBUG] provider: plugin exited 2023-09-19T07:47:50.038-0500 [DEBUG] Building and walking validate graph 2023-09-19T07:47:50.038-0500 [DEBUG] ProviderTransformer: "harness_platform_project.test" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.038-0500 [DEBUG] ProviderTransformer: "harness_platform_environment.dev" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.038-0500 [DEBUG] ProviderTransformer: "harness_platform_feature_flag_target.target1" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.038-0500 [DEBUG] ProviderTransformer: "harness_platform_feature_flag.flag2" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.038-0500 [DEBUG] ProviderTransformer: "harness_platform_feature_flag_target_group.targetgroup" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.038-0500 [DEBUG] ProviderTransformer: "harness_platform_feature_flag_target.target" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.038-0500 [DEBUG] ProviderTransformer: "data.harness_current_account.current" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.038-0500 [DEBUG] ProviderTransformer: "data.harness_platform_organization.test" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.038-0500 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/harness/harness\"]" references: [] 2023-09-19T07:47:50.038-0500 [DEBUG] ReferenceTransformer: "harness_platform_feature_flag_target.target" references: [data.harness_platform_organization.test harness_platform_project.test data.harness_current_account.current harness_platform_environment.dev] 2023-09-19T07:47:50.038-0500 [DEBUG] ReferenceTransformer: "data.harness_current_account.current" references: [] 2023-09-19T07:47:50.038-0500 [DEBUG] ReferenceTransformer: "data.harness_platform_organization.test" references: [] 2023-09-19T07:47:50.038-0500 [DEBUG] ReferenceTransformer: "harness_platform_feature_flag.flag2" references: [harness_platform_project.test data.harness_platform_organization.test harness_platform_feature_flag_target.target harness_platform_feature_flag_target.target1] 2023-09-19T07:47:50.038-0500 [DEBUG] ReferenceTransformer: "harness_platform_feature_flag_target_group.targetgroup" references: [harness_platform_project.test harness_platform_feature_flag_target.target1 harness_platform_environment.dev data.harness_platform_organization.test data.harness_current_account.current harness_platform_feature_flag_target.target] 2023-09-19T07:47:50.038-0500 [DEBUG] ReferenceTransformer: "harness_platform_project.test" references: [data.harness_platform_organization.test] 2023-09-19T07:47:50.038-0500 [DEBUG] ReferenceTransformer: "harness_platform_environment.dev" references: [data.harness_platform_organization.test harness_platform_project.test data.harness_platform_organization.test harness_platform_project.test] 2023-09-19T07:47:50.038-0500 [DEBUG] ReferenceTransformer: "harness_platform_feature_flag_target.target1" references: [data.harness_platform_organization.test harness_platform_project.test data.harness_current_account.current harness_platform_environment.dev] 2023-09-19T07:47:50.039-0500 [DEBUG] Starting graph walk: walkValidate 2023-09-19T07:47:50.039-0500 [DEBUG] created provider logger: level=debug 2023-09-19T07:47:50.039-0500 [INFO] provider: configuring client automatic mTLS 2023-09-19T07:47:50.043-0500 [DEBUG] provider: starting plugin: path=/Users/rileysnyder/git/terraform-provider-harness/terraform-provider-harness_v0.0.1 args=[/Users/rileysnyder/git/terraform-provider-harness/terraform-provider-harness_v0.0.1] 2023-09-19T07:47:50.046-0500 [DEBUG] provider: plugin started: path=/Users/rileysnyder/git/terraform-provider-harness/terraform-provider-harness_v0.0.1 pid=54132 2023-09-19T07:47:50.046-0500 [DEBUG] provider: waiting for RPC address: path=/Users/rileysnyder/git/terraform-provider-harness/terraform-provider-harness_v0.0.1 2023-09-19T07:47:50.060-0500 [INFO] provider.terraform-provider-harness_v0.0.1: configuring server automatic mTLS: timestamp=2023-09-19T07:47:50.060-0500 2023-09-19T07:47:50.072-0500 [DEBUG] provider: using plugin: version=5 2023-09-19T07:47:50.072-0500 [DEBUG] provider.terraform-provider-harness_v0.0.1: plugin address: address=/var/folders/54/4rq2vpp528scs1vqrd8485rh0000gp/T/plugin2977832583 network=unix timestamp=2023-09-19T07:47:50.072-0500 2023-09-19T07:47:50.098-0500 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF" 2023-09-19T07:47:50.099-0500 [DEBUG] provider: plugin process exited: path=/Users/rileysnyder/git/terraform-provider-harness/terraform-provider-harness_v0.0.1 pid=54132 2023-09-19T07:47:50.099-0500 [DEBUG] provider: plugin exited 2023-09-19T07:47:50.099-0500 [INFO] backend/local: apply calling Plan 2023-09-19T07:47:50.099-0500 [DEBUG] Building and walking plan graph for NormalMode 2023-09-19T07:47:50.099-0500 [DEBUG] ProviderTransformer: "data.harness_platform_organization.test (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.099-0500 [DEBUG] ProviderTransformer: "harness_platform_feature_flag.flag2 (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.099-0500 [DEBUG] ProviderTransformer: "harness_platform_feature_flag_target.target1 (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.099-0500 [DEBUG] ProviderTransformer: "harness_platform_project.test (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.099-0500 [DEBUG] ProviderTransformer: "harness_platform_feature_flag_target.target (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.099-0500 [DEBUG] ProviderTransformer: "harness_platform_feature_flag_target_group.targetgroup (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.099-0500 [DEBUG] ProviderTransformer: "harness_platform_environment.dev (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.099-0500 [DEBUG] ProviderTransformer: "data.harness_current_account.current (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.099-0500 [DEBUG] ReferenceTransformer: "harness_platform_feature_flag.flag2 (expand)" references: [harness_platform_project.test (expand) data.harness_platform_organization.test (expand) harness_platform_feature_flag_target.target (expand) harness_platform_feature_flag_target.target1 (expand)] 2023-09-19T07:47:50.099-0500 [DEBUG] ReferenceTransformer: "harness_platform_feature_flag_target_group.targetgroup (expand)" references: [data.harness_current_account.current (expand) harness_platform_feature_flag_target.target (expand) harness_platform_project.test (expand) harness_platform_environment.dev (expand) data.harness_platform_organization.test (expand) harness_platform_feature_flag_target.target1 (expand)] 2023-09-19T07:47:50.099-0500 [DEBUG] ReferenceTransformer: "harness_platform_environment.dev (expand)" references: [data.harness_platform_organization.test (expand) harness_platform_project.test (expand) data.harness_platform_organization.test (expand) harness_platform_project.test (expand)] 2023-09-19T07:47:50.099-0500 [DEBUG] ReferenceTransformer: "data.harness_current_account.current (expand)" references: [] 2023-09-19T07:47:50.099-0500 [DEBUG] ReferenceTransformer: "data.harness_platform_organization.test (expand)" references: [] 2023-09-19T07:47:50.099-0500 [DEBUG] ReferenceTransformer: "harness_platform_feature_flag_target.target (expand)" references: [data.harness_current_account.current (expand) harness_platform_environment.dev (expand) data.harness_platform_organization.test (expand) harness_platform_project.test (expand)] 2023-09-19T07:47:50.099-0500 [DEBUG] ReferenceTransformer: "harness_platform_feature_flag_target.target1 (expand)" references: [harness_platform_environment.dev (expand) data.harness_platform_organization.test (expand) harness_platform_project.test (expand) data.harness_current_account.current (expand)] 2023-09-19T07:47:50.099-0500 [DEBUG] ReferenceTransformer: "harness_platform_project.test (expand)" references: [data.harness_platform_organization.test (expand)] 2023-09-19T07:47:50.099-0500 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/harness/harness\"]" references: [] 2023-09-19T07:47:50.100-0500 [DEBUG] Starting graph walk: walkPlan 2023-09-19T07:47:50.100-0500 [DEBUG] created provider logger: level=debug 2023-09-19T07:47:50.100-0500 [INFO] provider: configuring client automatic mTLS 2023-09-19T07:47:50.104-0500 [DEBUG] provider: starting plugin: path=/Users/rileysnyder/git/terraform-provider-harness/terraform-provider-harness_v0.0.1 args=[/Users/rileysnyder/git/terraform-provider-harness/terraform-provider-harness_v0.0.1] 2023-09-19T07:47:50.107-0500 [DEBUG] provider: plugin started: path=/Users/rileysnyder/git/terraform-provider-harness/terraform-provider-harness_v0.0.1 pid=54133 2023-09-19T07:47:50.107-0500 [DEBUG] provider: waiting for RPC address: path=/Users/rileysnyder/git/terraform-provider-harness/terraform-provider-harness_v0.0.1 2023-09-19T07:47:50.118-0500 [INFO] provider.terraform-provider-harness_v0.0.1: configuring server automatic mTLS: timestamp=2023-09-19T07:47:50.117-0500 2023-09-19T07:47:50.130-0500 [DEBUG] provider: using plugin: version=5 2023-09-19T07:47:50.130-0500 [DEBUG] provider.terraform-provider-harness_v0.0.1: plugin address: address=/var/folders/54/4rq2vpp528scs1vqrd8485rh0000gp/T/plugin2795307447 network=unix timestamp=2023-09-19T07:47:50.130-0500 2023-09-19T07:47:50.153-0500 [WARN] ValidateProviderConfig from "provider[\"registry.terraform.io/harness/harness\"]" changed the config value, but that value is unused 2023-09-19T07:47:50.154-0500 [DEBUG] ReferenceTransformer: "data.harness_platform_organization.test" references: [] 2023-09-19T07:47:50.154-0500 [DEBUG] ReferenceTransformer: "data.harness_current_account.current" references: [] data.harness_current_account.current: Reading... data.harness_platform_organization.test: Reading... 2023-09-19T07:47:50.155-0500 [DEBUG] provider.terraform-provider-harness_v0.0.1: 2023/09/19 07:47:50 [DEBUG] GET https://app.harness.io/gateway/ng/api/organizations/test?accountIdentifier=wlgELJ0TTre5aZhzpt8gVA data.harness_current_account.current: Read complete after 0s [id=wlgELJ0TTre5aZhzpt8gVA] data.harness_platform_organization.test: Read complete after 0s [id=test] 2023-09-19T07:47:50.363-0500 [DEBUG] ReferenceTransformer: "harness_platform_project.test" references: [] harness_platform_project.test: Refreshing state... [id=testproject] 2023-09-19T07:47:50.366-0500 [DEBUG] provider.terraform-provider-harness_v0.0.1: 2023/09/19 07:47:50 [DEBUG] GET https://app.harness.io/gateway/ng/api/projects/testproject?accountIdentifier=wlgELJ0TTre5aZhzpt8gVA&orgIdentifier=test 2023-09-19T07:47:50.481-0500 [WARN] Provider "registry.terraform.io/harness/harness" produced an invalid plan for harness_platform_project.test, but we are tolerating it because it is using the legacy plugin SDK. The following problems may be the cause of any confusing errors from downstream operations: - .description: planned value cty.StringVal("") for a non-computed attribute - .tags: planned value cty.SetValEmpty(cty.String) for a non-computed attribute 2023-09-19T07:47:50.482-0500 [DEBUG] ReferenceTransformer: "harness_platform_environment.dev" references: [] harness_platform_environment.dev: Refreshing state... [id=dev1] 2023-09-19T07:47:50.484-0500 [DEBUG] provider.terraform-provider-harness_v0.0.1: 2023/09/19 07:47:50 [DEBUG] GET https://app.harness.io/gateway/ng/api/environmentsV2/dev1?accountIdentifier=wlgELJ0TTre5aZhzpt8gVA&orgIdentifier=test&projectIdentifier=testproject 2023-09-19T07:47:50.591-0500 [WARN] Provider "registry.terraform.io/harness/harness" produced an invalid plan for harness_platform_environment.dev, but we are tolerating it because it is using the legacy plugin SDK. The following problems may be the cause of any confusing errors from downstream operations: - .description: planned value cty.StringVal("") for a non-computed attribute - .tags: planned value cty.SetValEmpty(cty.String) for a non-computed attribute 2023-09-19T07:47:50.591-0500 [DEBUG] ReferenceTransformer: "harness_platform_feature_flag_target.target" references: [] 2023-09-19T07:47:50.591-0500 [DEBUG] ReferenceTransformer: "harness_platform_feature_flag_target.target1" references: [] harness_platform_feature_flag_target.target1: Refreshing state... [id=target1] harness_platform_feature_flag_target.target: Refreshing state... [id=target] 2023-09-19T07:47:50.593-0500 [DEBUG] provider.terraform-provider-harness_v0.0.1: 2023/09/19 07:47:50 [DEBUG] GET https://app.harness.io/gateway/cf/admin/targets/target?accountIdentifier=wlgELJ0TTre5aZhzpt8gVA&environmentIdentifier=dev1&orgIdentifier=test&projectIdentifier=testproject 2023-09-19T07:47:50.593-0500 [DEBUG] provider.terraform-provider-harness_v0.0.1: 2023/09/19 07:47:50 [DEBUG] GET https://app.harness.io/gateway/cf/admin/targets/target1?accountIdentifier=wlgELJ0TTre5aZhzpt8gVA&environmentIdentifier=dev1&orgIdentifier=test&projectIdentifier=testproject 2023-09-19T07:47:50.753-0500 [DEBUG] ReferenceTransformer: "harness_platform_feature_flag_target_group.targetgroup" references: [] 2023-09-19T07:47:50.753-0500 [DEBUG] Resource instance state not found for node "harness_platform_feature_flag.flag2", instance harness_platform_feature_flag.flag2 2023-09-19T07:47:50.754-0500 [DEBUG] ReferenceTransformer: "harness_platform_feature_flag.flag2" references: [] 2023-09-19T07:47:50.754-0500 [DEBUG] refresh: harness_platform_feature_flag.flag2: no state, so not refreshing harness_platform_feature_flag_target_group.targetgroup: Refreshing state... [id=targetgroup] 2023-09-19T07:47:50.756-0500 [DEBUG] provider.terraform-provider-harness_v0.0.1: 2023/09/19 07:47:50 [DEBUG] GET https://app.harness.io/gateway/cf/admin/segments/targetgroup?accountIdentifier=wlgELJ0TTre5aZhzpt8gVA&environmentIdentifier=dev1&orgIdentifier=test&projectIdentifier=testproject 2023-09-19T07:47:50.858-0500 [INFO] provider.terraform-provider-harness_v0.0.1: 2023/09/19 07:47:50 [ERROR] setting state: Invalid address to set: []string{"project"}: timestamp=2023-09-19T07:47:50.858-0500 2023-09-19T07:47:50.859-0500 [INFO] provider.terraform-provider-harness_v0.0.1: 2023/09/19 07:47:50 [ERROR] setting state: included.0: '' expected type 'string', got unconvertible type 'nextgen.Target', value: '{ false 0 target target []}': timestamp=2023-09-19T07:47:50.858-0500 2023-09-19T07:47:50.859-0500 [INFO] provider.terraform-provider-harness_v0.0.1: 2023/09/19 07:47:50 [ERROR] setting state: excluded.0: '' expected type 'string', got unconvertible type 'nextgen.Target', value: '{ false 0 target1 target1 []}': timestamp=2023-09-19T07:47:50.858-0500 2023-09-19T07:47:50.859-0500 [INFO] provider.terraform-provider-harness_v0.0.1: 2023/09/19 07:47:50 [ERROR] setting state: Invalid address to set: []string{"rules"}: timestamp=2023-09-19T07:47:50.858-0500 2023-09-19T07:47:50.862-0500 [WARN] Provider "registry.terraform.io/harness/harness" produced an invalid plan for harness_platform_feature_flag_target_group.targetgroup, but we are tolerating it because it is using the legacy plugin SDK. The following problems may be the cause of any confusing errors from downstream operations: - .rule[0].negate: planned value cty.False for a non-computed attribute - .rule[1].negate: planned value cty.False for a non-computed attribute 2023-09-19T07:47:50.864-0500 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF" 2023-09-19T07:47:50.867-0500 [DEBUG] provider: plugin process exited: path=/Users/rileysnyder/git/terraform-provider-harness/terraform-provider-harness_v0.0.1 pid=54133 2023-09-19T07:47:50.867-0500 [DEBUG] provider: plugin exited 2023-09-19T07:47:50.867-0500 [DEBUG] building apply graph to check for errors 2023-09-19T07:47:50.867-0500 [DEBUG] Resource state not found for node "harness_platform_feature_flag.flag2", instance harness_platform_feature_flag.flag2 2023-09-19T07:47:50.867-0500 [DEBUG] ProviderTransformer: "harness_platform_project.test (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.867-0500 [DEBUG] ProviderTransformer: "harness_platform_feature_flag_target.target1 (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.867-0500 [DEBUG] ProviderTransformer: "data.harness_platform_organization.test (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.867-0500 [DEBUG] ProviderTransformer: "harness_platform_environment.dev (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.867-0500 [DEBUG] ProviderTransformer: "harness_platform_feature_flag_target.target (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.867-0500 [DEBUG] ProviderTransformer: "harness_platform_feature_flag_target_group.targetgroup (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.867-0500 [DEBUG] ProviderTransformer: "harness_platform_feature_flag.flag2" (*terraform.NodeApplyableResourceInstance) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.867-0500 [DEBUG] ProviderTransformer: "harness_platform_feature_flag.flag2 (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.868-0500 [DEBUG] ProviderTransformer: "data.harness_current_account.current (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/harness/harness"] 2023-09-19T07:47:50.868-0500 [DEBUG] ReferenceTransformer: "harness_platform_environment.dev (expand)" references: [] 2023-09-19T07:47:50.868-0500 [DEBUG] ReferenceTransformer: "harness_platform_feature_flag_target.target (expand)" references: [] 2023-09-19T07:47:50.868-0500 [DEBUG] ReferenceTransformer: "harness_platform_feature_flag_target_group.targetgroup (expand)" references: [] 2023-09-19T07:47:50.868-0500 [DEBUG] ReferenceTransformer: "harness_platform_feature_flag.flag2" references: [harness_platform_project.test (expand) data.harness_platform_organization.test (expand) harness_platform_feature_flag_target.target (expand) harness_platform_feature_flag_target.target1 (expand)] 2023-09-19T07:47:50.868-0500 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/harness/harness\"]" references: [] 2023-09-19T07:47:50.868-0500 [DEBUG] ReferenceTransformer: "harness_platform_project.test (expand)" references: [] 2023-09-19T07:47:50.868-0500 [DEBUG] ReferenceTransformer: "harness_platform_feature_flag_target.target1 (expand)" references: [] 2023-09-19T07:47:50.868-0500 [DEBUG] ReferenceTransformer: "harness_platform_feature_flag.flag2 (expand)" references: [] 2023-09-19T07:47:50.868-0500 [DEBUG] ReferenceTransformer: "data.harness_current_account.current (expand)" references: [] 2023-09-19T07:47:50.868-0500 [DEBUG] ReferenceTransformer: "data.harness_platform_organization.test (expand)" references: [] 2023-09-19T07:47:50.868-0500 [DEBUG] pruneUnusedNodes: harness_platform_environment.dev (expand) is no longer needed, removing 2023-09-19T07:47:50.868-0500 [DEBUG] pruneUnusedNodes: harness_platform_feature_flag_target_group.targetgroup (expand) is no longer needed, removing 2023-09-19T07:47:50.868-0500 [DEBUG] pruneUnusedNodes: data.harness_current_account.current (expand) is no longer needed, removing

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:

  • create

Terraform will perform the following actions:

harness_platform_feature_flag.flag2 will be created

  • resource "harness_platform_feature_flag" "flag2" {
    • default_off_variation = "Disabled"

    • default_on_variation = "Enabled"

    • id = (known after apply)

    • identifier = "flag22"

    • kind = "boolean"

    • name = "flag22"

    • org_id = "test"

    • permanent = false

    • project_id = "testproject"

    • add_target_rule {

      • targets = [
        • "target",
          ]
      • variation = "Enabled"
        }
    • add_target_rule {

      • targets = [
        • "target1",
          ]
      • variation = "Disabled"
        }
    • variation {

      • description = "The feature is enabled"
      • identifier = "Enabled"
      • name = "Enabled"
      • value = "true"
        }
    • variation {

      • description = "The feature is disabled"
      • identifier = "Disabled"
      • name = "Disabled"
      • value = "false"
        }
        }

Plan: 1 to add, 0 to change, 0 to destroy.
2023-09-19T07:47:50.872-0500 [DEBUG] command: asking for input: "\nDo you want to perform these actions?"

Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.

Enter a value: yes

2023-09-19T07:47:52.373-0500 [INFO] backend/local: apply calling Apply
2023-09-19T07:47:52.373-0500 [DEBUG] Building and walking apply graph for NormalMode plan
2023-09-19T07:47:52.374-0500 [DEBUG] Resource state not found for node "harness_platform_feature_flag.flag2", instance harness_platform_feature_flag.flag2
2023-09-19T07:47:52.374-0500 [DEBUG] ProviderTransformer: "data.harness_platform_organization.test (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/harness/harness"]
2023-09-19T07:47:52.374-0500 [DEBUG] ProviderTransformer: "data.harness_current_account.current (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/harness/harness"]
2023-09-19T07:47:52.374-0500 [DEBUG] ProviderTransformer: "harness_platform_feature_flag.flag2 (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/harness/harness"]
2023-09-19T07:47:52.374-0500 [DEBUG] ProviderTransformer: "harness_platform_feature_flag.flag2" (*terraform.NodeApplyableResourceInstance) needs provider["registry.terraform.io/harness/harness"]
2023-09-19T07:47:52.374-0500 [DEBUG] ProviderTransformer: "harness_platform_environment.dev (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/harness/harness"]
2023-09-19T07:47:52.374-0500 [DEBUG] ProviderTransformer: "harness_platform_feature_flag_target.target (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/harness/harness"]
2023-09-19T07:47:52.374-0500 [DEBUG] ProviderTransformer: "harness_platform_feature_flag_target.target1 (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/harness/harness"]
2023-09-19T07:47:52.374-0500 [DEBUG] ProviderTransformer: "harness_platform_feature_flag_target_group.targetgroup (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/harness/harness"]
2023-09-19T07:47:52.374-0500 [DEBUG] ProviderTransformer: "harness_platform_project.test (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/harness/harness"]
2023-09-19T07:47:52.375-0500 [DEBUG] ReferenceTransformer: "harness_platform_environment.dev (expand)" references: []
2023-09-19T07:47:52.375-0500 [DEBUG] ReferenceTransformer: "harness_platform_feature_flag_target.target (expand)" references: []
2023-09-19T07:47:52.375-0500 [DEBUG] ReferenceTransformer: "harness_platform_feature_flag_target.target1 (expand)" references: []
2023-09-19T07:47:52.375-0500 [DEBUG] ReferenceTransformer: "harness_platform_feature_flag_target_group.targetgroup (expand)" references: []
2023-09-19T07:47:52.375-0500 [DEBUG] ReferenceTransformer: "harness_platform_project.test (expand)" references: []
2023-09-19T07:47:52.375-0500 [DEBUG] ReferenceTransformer: "data.harness_current_account.current (expand)" references: []
2023-09-19T07:47:52.375-0500 [DEBUG] ReferenceTransformer: "provider["registry.terraform.io/harness/harness"]" references: []
2023-09-19T07:47:52.375-0500 [DEBUG] ReferenceTransformer: "harness_platform_feature_flag.flag2 (expand)" references: []
2023-09-19T07:47:52.375-0500 [DEBUG] ReferenceTransformer: "data.harness_platform_organization.test (expand)" references: []
2023-09-19T07:47:52.375-0500 [DEBUG] ReferenceTransformer: "harness_platform_feature_flag.flag2" references: [harness_platform_project.test (expand) data.harness_platform_organization.test (expand) harness_platform_feature_flag_target.target (expand) harness_platform_feature_flag_target.target1 (expand)]
2023-09-19T07:47:52.375-0500 [DEBUG] pruneUnusedNodes: harness_platform_feature_flag_target_group.targetgroup (expand) is no longer needed, removing
2023-09-19T07:47:52.375-0500 [DEBUG] pruneUnusedNodes: data.harness_current_account.current (expand) is no longer needed, removing
2023-09-19T07:47:52.375-0500 [DEBUG] pruneUnusedNodes: harness_platform_environment.dev (expand) is no longer needed, removing
2023-09-19T07:47:52.375-0500 [DEBUG] Starting graph walk: walkApply
2023-09-19T07:47:52.377-0500 [DEBUG] created provider logger: level=debug
2023-09-19T07:47:52.377-0500 [INFO] provider: configuring client automatic mTLS
2023-09-19T07:47:52.386-0500 [DEBUG] provider: starting plugin: path=/Users/rileysnyder/git/terraform-provider-harness/terraform-provider-harness_v0.0.1 args=[/Users/rileysnyder/git/terraform-provider-harness/terraform-provider-harness_v0.0.1]
2023-09-19T07:47:52.392-0500 [DEBUG] provider: plugin started: path=/Users/rileysnyder/git/terraform-provider-harness/terraform-provider-harness_v0.0.1 pid=54136
2023-09-19T07:47:52.392-0500 [DEBUG] provider: waiting for RPC address: path=/Users/rileysnyder/git/terraform-provider-harness/terraform-provider-harness_v0.0.1
2023-09-19T07:47:52.408-0500 [INFO] provider.terraform-provider-harness_v0.0.1: configuring server automatic mTLS: timestamp=2023-09-19T07:47:52.407-0500
2023-09-19T07:47:52.423-0500 [DEBUG] provider: using plugin: version=5
2023-09-19T07:47:52.423-0500 [DEBUG] provider.terraform-provider-harness_v0.0.1: plugin address: address=/var/folders/54/4rq2vpp528scs1vqrd8485rh0000gp/T/plugin102823189 network=unix timestamp=2023-09-19T07:47:52.423-0500
2023-09-19T07:47:52.446-0500 [WARN] ValidateProviderConfig from "provider["registry.terraform.io/harness/harness"]" changed the config value, but that value is unused
harness_platform_feature_flag.flag2: Creating...
2023-09-19T07:47:52.449-0500 [INFO] Starting apply for harness_platform_feature_flag.flag2
2023-09-19T07:47:52.449-0500 [DEBUG] harness_platform_feature_flag.flag2: applying the planned Create change
2023-09-19T07:47:52.450-0500 [DEBUG] provider.terraform-provider-harness_v0.0.1: 2023/09/19 07:47:52 [DEBUG] POST https://app.harness.io/gateway/cf/admin/features?accountIdentifier=wlgELJ0TTre5aZhzpt8gVA&orgIdentifier=test
2023-09-19T07:47:52.673-0500 [DEBUG] provider.terraform-provider-harness_v0.0.1: 2023/09/19 07:47:52 [DEBUG] GET https://app.harness.io/gateway/cf/admin/features/flag22?accountIdentifier=wlgELJ0TTre5aZhzpt8gVA&orgIdentifier=test&projectIdentifier=testproject
2023-09-19T07:47:52.998-0500 [INFO] provider.terraform-provider-harness_v0.0.1: 2023/09/19 07:47:52 [ERROR] setting state: Invalid address to set: []string{"description"}: timestamp=2023-09-19T07:47:52.997-0500
2023-09-19T07:47:52.999-0500 [DEBUG] provider.terraform-provider-harness_v0.0.1: 2023/09/19 07:47:52 [DEBUG] PATCH https://app.harness.io/gateway/cf/admin/features/flag22?accountIdentifier=wlgELJ0TTre5aZhzpt8gVA&environmentIdentifier=&orgIdentifier=test&projectIdentifier=testproject
2023-09-19T07:47:53.105-0500 [ERROR] provider.terraform-provider-harness_v0.0.1: Response contains error diagnostic: tf_req_id=cd719b25-7aae-d519-95cc-1c58ae856975 tf_rpc=ApplyResourceChange diagnostic_detail= tf_proto_version=5.3 tf_provider_addr=provider diagnostic_severity=ERROR diagnostic_summary="Empty Summary: This is always a bug in the provider and should be reported to the provider developers." tf_resource_type=harness_platform_feature_flag @caller=/Users/rileysnyder/go/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.18.0/tfprotov5/internal/diag/diagnostics.go:58 @module=sdk.proto timestamp=2023-09-19T07:47:53.104-0500
2023-09-19T07:47:53.118-0500 [ERROR] vertex "harness_platform_feature_flag.flag2" error: Empty Summary: This is always a bug in the provider and should be reported to the provider developers.

│ Error: Empty Summary: This is always a bug in the provider and should be reported to the provider developers.

│ with harness_platform_feature_flag.flag2,
│ on main.tf line 71, in resource "harness_platform_feature_flag" "flag2":
│ 71: resource "harness_platform_feature_flag" "flag2" {


2023-09-19T07:47:53.129-0500 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2023-09-19T07:47:53.130-0500 [DEBUG] provider: plugin process exited: path=/Users/rileysnyder/git/terraform-provider-harness/terraform-provider-harness_v0.0.1 pid=54136
2023-09-19T07:47:53.131-0500 [DEBUG] provider: plugin exited

</details>

@davejohnston
Copy link

davejohnston commented Sep 19, 2023

@rssnyder I'm not certain, but is the environment here in the resource? If we add a rule it has to apply to an environment. I figure if its not supplied somewhere its likely to result in an error.

@rssnyder
Copy link
Contributor

@rssnyder I'm not certain, but is the environment here in the resource? If we add a rule it has to apply to an environment. I figure if its not supplied somewhere its likely to result in an error.

Great point, I didn't even realize I wasn't referencing the environment anywhere. @ribeirophillipe it seems that the add_target_rule schema probably needs an environment reference somewhere, I am curious how you are getting this to work without it?

@ribeirophillipe
Copy link
Contributor Author

@rssnyder I've added an "environment" to the schema for the target_flag...

* Enable feature flags to configure targets
* Update test cases
* Fix bug in the distribution
@ribeirophillipe
Copy link
Contributor Author

trigger subcategoryfieldcheck

@ribeirophillipe
Copy link
Contributor Author

trigger gitleaks

@ribeirophillipe
Copy link
Contributor Author

trigger build

davejohnston
davejohnston previously approved these changes Sep 20, 2023
Copy link

@davejohnston davejohnston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Distribution and Serve are now pointers. I understand that with this we can only add rules to a single env and the follow up PR will provide support for multiple envs.

@ribeirophillipe ribeirophillipe merged commit 65d0b30 into main Sep 20, 2023
3 checks passed
@ribeirophillipe ribeirophillipe deleted the FFM-9404 branch September 20, 2023 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants