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

aws.redshift.ResourcePolicy triggering update if "Resource" is not set in the policy #4411

Open
Ownmarc opened this issue Aug 27, 2024 · 2 comments
Labels
area/docs Improvements or additions to documentation kind/enhancement Improvements or new features

Comments

@Ownmarc
Copy link

Ownmarc commented Aug 27, 2024

Describe what happened

When creating an aws.redshift.ResourcePolicy, AWS will accept a policy that doesn't include "Resource" and will set it for us but if it is not in our code, it will trigger an update every deploy.

I got arround it by setting it explicitly in my policy definition.

Sample program

This will trigger an update on every deploy, but is setting everything as expected :

redshiftserverless_resource_policy = aws.redshift.ResourcePolicy(
    "redshiftserverless-resource-policy",
    resource_arn=redshiftserverless_namespace.arn,
    policy=pulumi.Output.json_dumps({
        "Version": "2012-10-17",
        "Statement": [
            {
                "Effect": "Allow",
                "Principal": {"Service": "redshift.amazonaws.com"},
                "Action": "redshift:AuthorizeInboundIntegration",
                "Condition": {"StringEquals": {"aws:SourceArn": east_cluster.arn}},
            },
            {
                "Effect": "Allow",
                "Principal": {"AWS": account_id},
                "Action": "redshift:CreateInboundIntegration",
            },
        ],
    }),
)

This is what is needed (adding "Resource" explicitly in the policy) to not trigger an update on every deploy :

redshiftserverless_resource_policy = aws.redshift.ResourcePolicy(
    "redshiftserverless-resource-policy",
    resource_arn=redshiftserverless_namespace.arn,
    policy=pulumi.Output.json_dumps({
        "Version": "2012-10-17",
        "Statement": [
            {
                "Effect": "Allow",
                "Principal": {"Service": "redshift.amazonaws.com"},
                "Action": "redshift:AuthorizeInboundIntegration",
                "Resource": redshiftserverless_namespace.arn,
                "Condition": {"StringEquals": {"aws:SourceArn": east_cluster.arn}},
            },
            {
                "Effect": "Allow",
                "Principal": {"AWS": account_id},
                "Action": "redshift:CreateInboundIntegration",
                "Resource": redshiftserverless_namespace.arn,
            },
        ],
    }),
)

Log output

No response

Affected Resource(s)

No response

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.1
resource awsx 2.14.0
resource docker 4.5.5
language python unknown

Additional context

No response

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).

@Ownmarc Ownmarc added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Aug 27, 2024
@corymhall
Copy link
Contributor

@Ownmarc this behavior is expected, but should probably be documented better. I'll leave this issue open to track the documentation issue.

@corymhall corymhall added area/docs Improvements or additions to documentation and removed kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Aug 30, 2024
@Ownmarc
Copy link
Author

Ownmarc commented Aug 30, 2024

Thanks, yea, reason I was able to figure it out was that I went into my cloudtrail logs and looked at what the API was sending back as a response. There was probably an other way to find out, but I don't know it.

@mikhailshilkov mikhailshilkov added the kind/enhancement Improvements or new features label Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docs Improvements or additions to documentation kind/enhancement Improvements or new features
Projects
None yet
Development

No branches or pull requests

3 participants