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

Refreshing a aws:vpc:SecurityGroupEgressRule fails with AutoFlex Flatten; incompatible types #4372

Closed
Makeshift opened this issue Aug 15, 2024 · 3 comments · Fixed by #4378
Closed
Assignees
Labels
awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed

Comments

@Makeshift
Copy link

Makeshift commented Aug 15, 2024

Describe what happened

Refreshing a SecurityGroupEgressRule resource causes incompatible type errors in the terraform-plugin-framework.

Sample program

import * as aws from "@pulumi/aws"
import * as pulumi from "@pulumi/pulumi"

const config = new pulumi.Config()

const buildSecurityGroup = new aws.ec2.SecurityGroup('build-sg', {
  description: 'Test SG',
  vpcId: config.require('vpcId')
})

new aws.vpc.SecurityGroupEgressRule('build-sg-egress', {
  description: 'Allow all outbound traffic',
  securityGroupId: buildSecurityGroup.id,
  cidrIpv4: '0.0.0.0/0',
  ipProtocol: '-1'
}, { parent: buildSecurityGroup })

Full reproduction repo here. Note that in Pulumi.yaml, options.refresh is set to true.

Steps to reproduce:

  • Deploy the stack
  • Attempt to preview or deploy the stack again (causing a refresh) or alternatively run pulumi refresh
  • Pulumi should output the below error message

Log output

Snippet of log:

Diagnostics:
  aws:vpc:SecurityGroupEgressRule (build-sg-egress):
    error:   flex/auto_flatten.go:171: provider.autoflex: AutoFlex Flatten; incompatible types: autoflex.source.type=<nil> autoflex.target.type=github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue autoflex.target.path="" [email protected] autoflex.source.path="" to=basetypes.StringType from=invalid
    error:   flex/auto_flatten.go:171: provider.autoflex: AutoFlex Flatten; incompatible types: [email protected] autoflex.source.path="" autoflex.target.path="" autoflex.target.type=github.com/hashicorp/terraform-plugin-framework/types/basetypes.StringValue autoflex.source.type=<nil> from=invalid to=basetypes.StringType

Full debug log can be found here

Affected Resource(s)

The only resource I've noticed it affecting is aws:vpc:SecurityGroupEgressRule, though ingress rules and others may also be affected.

Output of pulumi about

CLI
Version      3.129.0
Go Version   go1.22.6
Go Compiler  gc

Plugins
KIND      NAME        VERSION
resource  aws         6.49.0
resource  aws-native  0.116.0
resource  awsx        2.14.0
resource  docker      4.5.5
resource  docker      3.6.1
language  nodejs      unknown (@makeshift edit - it's 18.18.2)

Host
OS       ubuntu
Version  23.04
Arch     x86_64

This project is written in nodejs: executable='/home/connor/.nvm/versions/node/v18.18.2/bin/node' version='v18.18.2'

Current Stack: organization/pulumi-securitygroup-bug/dev

TYPE                                                     URN
pulumi:pulumi:Stack                                      urn:pulumi:dev::pulumi-securitygroup-bug::pulumi:pulumi:Stack::pulumi-securitygroup-bug-dev
pulumi:providers:aws                                     urn:pulumi:dev::pulumi-securitygroup-bug::pulumi:providers:aws::default_6_49_0
aws:ec2/securityGroup:SecurityGroup                      urn:pulumi:dev::pulumi-securitygroup-bug::aws:ec2/securityGroup:SecurityGroup::build-sg
aws:vpc/securityGroupEgressRule:SecurityGroupEgressRule  urn:pulumi:dev::pulumi-securitygroup-bug::aws:ec2/securityGroup:SecurityGroup$aws:vpc/securityGroupEgressRule:SecurityGroupEgressRule::build-sg-egress


Found no pending operations associated with dev

Backend
Name           einstein
URL            s3://ebx-pulumi-state-store-prod/?profile=original-main-account
User           connor
Organizations
Token type     personal

Dependencies:
NAME                VERSION
@pulumi/aws-native  0.116.0
@pulumi/aws         6.49.0
@pulumi/awsx        2.14.0
@pulumi/pulumi      3.129.0
@types/node         18.19.44
typescript          5.5.4

Additional context

This can be worked around by using --continue-on-error or disabling refresh during preview/deployment, though it obviously isn't ideal.

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@Makeshift Makeshift added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Aug 15, 2024
@t0yv0
Copy link
Member

t0yv0 commented Aug 15, 2024

This looks like hashicorp/terraform-provider-aws#38830 and should go away once we upgrade upstream to v5.63.0. I'm sorry you are hitting this issue.

@t0yv0 t0yv0 added awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). and removed needs-triage Needs attention from the triage team labels Aug 15, 2024
@t0yv0 t0yv0 closed this as completed in 198219a Aug 21, 2024
@pulumi-bot pulumi-bot added resolution/fixed This issue was fixed labels Aug 21, 2024
@pulumi-bot
Copy link
Contributor

This issue has been addressed in PR #4378 and shipped in release v6.50.0.

@bmillwood
Copy link

FWIW I found that even after upgrading my AWS plugin, I was still hitting the error. I did some terrible nonsense in order to delete the affected resources from my state and reimport them with the new provider, and that seemed to fix it. (Can say more about what exactly I did if anyone else has the same problem.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants