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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

awscc_apigateway_method permanent diff within integration_responses block #747

Open
breathingdust opened this issue Nov 22, 2022 · 0 comments

Comments

@breathingdust
Copy link
Member

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
  • The resources and data sources in this provider are generated from the CloudFormation schema, so they can only support the actions that the underlying schema supports. For this reason submitted bugs should be limited to defects in the generation and runtime code of the provider. Customizing behavior of the resource, or noting a gap in behavior are not valid bugs and should be submitted as enhancements to AWS via the CloudFormation Open Coverage Roadmap.

Terraform CLI and Terraform AWS Cloud Control Provider Version

Affected Resource(s)

  • awscc_apigateway_method

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 {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 4.38"
    }

    awscc = {
      source  = "hashicorp/awscc"
      version = "~> 0.38"
    }
  }
}

provider "awscc" {
  region = "us-west-2"
}

provider "aws" {
  region = "us-west-2"
}

data "aws_region" "current" {}

resource "aws_api_gateway_rest_api" "repro" {
  name = "repro"
  endpoint_configuration {
    types = ["EDGE"]
  }  
}

resource "awscc_apigateway_method" "post" {
  rest_api_id = aws_api_gateway_rest_api.repro.id
  resource_id = aws_api_gateway_rest_api.repro.root_resource_id
  http_method = "POST"
  authorization_type = "NONE"

  integration = {
    type = "AWS"
    integration_http_method = "POST"
    uri                     = "arn:aws:apigateway:${data.aws_region.current.name}:lambda:path/2015-03-31/functions/${awscc_lambda_function.function.arn}/invocations"
    integration_responses = [
      {
        status_code = "200"    
        response_parameters = {
          "method.response.header.Access-Control-Allow-Origin" = "'*'"
        }
      }
    ]
  }

  method_responses = [
    {
      status_code = "200"
      response_models = {
        "application/json" = "Empty"
      }
      response_parameters = {
          "method.response.header.Access-Control-Allow-Headers" = true,
          "method.response.header.Access-Control-Allow-Methods" = true,
          "method.response.header.Access-Control-Allow-Origin" = true
      }
    }
  ]
}

resource "awscc_lambda_function" "function" {
    function_name = "foo"
    runtime = "python3.8"
    code = {
        zip_file = <<EOT
import boto3

    return {
        'statusCode': 200,
        'body': json.dumps('Hello from Lambda', ' + name')
    }
EOT
    }
    role = awscc_iam_role.role.arn
    handler = "index.lambda_handler"
}

resource "awscc_iam_role" "role" {
    assume_role_policy_document = jsonencode({
      "Version": "2012-10-17",
      "Statement": [
        {
          "Action": "sts:AssumeRole",
          "Principal": {
            "Service": "lambda.amazonaws.com"
          },
          "Effect": "Allow",
          "Sid": ""
        }
      ]
    })
}

Debug Output

Panic Output

Expected Behavior

No changes detected and no plan generated

Actual Behavior

Plan generated:

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:

  # awscc_apigateway_method.post will be updated in-place
  ~ resource "awscc_apigateway_method" "post" {
      + authorization_scopes = (known after apply)
      + authorizer_id        = (known after apply)
        id                   = "e9h31f2rfj|t7ly4shwy6|POST"
      ~ integration          = {
          + cache_key_parameters    = (known after apply)
          + connection_id           = (known after apply)
          + connection_type         = (known after apply)
          + content_handling        = (known after apply)
          + credentials             = (known after apply)
          ~ integration_responses   = [
              ~ {
                  + content_handling    = (known after apply)
                  + response_templates  = (known after apply)
                  + selection_pattern   = (known after apply)
                    # (2 unchanged attributes hidden)
                },
            ]
          + request_parameters      = (known after apply)
          + request_templates       = (known after apply)
            # (6 unchanged attributes hidden)
        }
      + operation_name       = (known after apply)
      + request_models       = (known after apply)
      + request_parameters   = (known after apply)
      + request_validator_id = (known after apply)
        # (6 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Steps to Reproduce

  1. terraform apply
  2. terraform plan

Important Factoids

References

Potentially related to: hashicorp/terraform#31887

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant