hashicorp / terraform-provider-awscc

Terraform AWS Cloud Control provider
https://registry.terraform.io/providers/hashicorp/awscc/latest/docs
Mozilla Public License 2.0
262 stars 120 forks source link

awscc_sso_assignments data source fails terraform plan unconditionally #2047

Open yanilov opened 1 month ago

yanilov commented 1 month ago

Community Note

Terraform CLI and Terraform AWS Cloud Control Provider Version

Terraform v1.9.6 on darwin_arm64

Affected Resource(s)

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

terraform {
  required_providers {
    awscc = {
      source  = "hashicorp/awscc"
      version = "~> 1.16"
    }
  }
  required_version = "~> 1.2"
}

variable "region" {
  type = string
}

provider "awscc" {
  region = var.region
}

data "awscc_sso_assignments" "main" {}

Expected Behavior

terraform plan is able to get the list of assignments and populate the data source.

Actual Behavior

plan fails due to missing required properties:

data.awscc_sso_assignments.main: Reading...

Planning failed. Terraform encountered an error while generating this plan.

β•·
β”‚ Error: AWS SDK Go Service Operation Unsuccessful
β”‚
β”‚   with data.awscc_sso_assignments.main,
β”‚   on main.tf line 32, in data "awscc_sso_assignments" "main":
β”‚   32: data "awscc_sso_assignments" "main" {}
β”‚
β”‚ Calling CloudControl service ListResources operation returned: operation error CloudControl: ListResources, https response error StatusCode: 400, RequestID: ce3eb622-4df2-4737-8f6a-a5c3bf678250, InvalidRequestException: Missing Or
β”‚ Invalid ResourceModel property in AWS::SSO::Assignment list handler request input. Required property: [InstanceArn, PermissionSetArn, PrincipalId, PrincipalType, TargetId, TargetType]

Steps to Reproduce

  1. run aws sso login and log into the organization's management account
  2. run tf plan -var region=<REGION> , specifying the region in which the SSO instance is deployed, e.g. tf plan -var region=us-east-1
quixoticmonk commented 1 month ago

Thank you for opening the issue @yanilov . Opening an internal service ticket to review the schema as the list-resources using CC API returns a similar message.

aws cloudcontrol list-resources --type-name AWS::SSO::Assignment

An error occurred (InvalidRequestException) when calling the ListResources operation: 
Missing Or Invalid ResourceModel property in AWS::SSO::Assignment 
list handler request input. 
Required property: [InstanceArn, PermissionSetArn, 
PrincipalId, PrincipalType, TargetId, TargetType]