pulumi-aws icon indicating copy to clipboard operation
pulumi-aws copied to clipboard

Always changed `aws.apigatewayv2.Stage.defaultRouteSettings.loggingLevel`

Open ViktorCollin opened this issue 2 years ago • 4 comments

What happened?

Creating a resource of type aws.apigatewayv2.Stage with a property defaultRouteSettings.loggingLevel set to either ERROR or INFO will always report a diff [diff: ~defaultRouteSettings]

As far as i can find there is no logging level setting for HTTP API (https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-logging.html) it is only relevant for REST API

Expected Behavior

I don't expect there to be any diff between two consecutive runs of pulumi up

Steps to reproduce

  1. create the following resoruce and run pulumi up
const apiStage = new aws.apigatewayv2.Stage(
 'stage',
  {
    apiId: api.id,
    name: '$default',
    accessLogSettings: {
      destinationArn: logGroup.arn,
      format: JSON.stringify(logFormat),
    },
    defaultRouteSettings: { loggingLevel: 'ERROR' }
  },
);

2 Run pulumi preview or pulumi up it will display a diff which is unexpected

Output of pulumi about

CLI
Version 3.54.0 Go Version go1.19.5 Go Compiler gc

Plugins NAME VERSION aws 5.29.1 aws-apigateway 1.0.1 docker 3.6.1 nodejs unknown

Host
OS darwin Version 12.6 Arch x86_64

This project is written in nodejs: executable='...node' version='v16.18.0'

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

ViktorCollin avatar Feb 13 '23 11:02 ViktorCollin

Confirmed, with this program:

"use strict";
const pulumi = require("@pulumi/pulumi");
const aws = require("@pulumi/aws");
const awsx = require("@pulumi/awsx");

const example = new aws.apigatewayv2.Api("example", {
    protocolType: "HTTP",
});

const apiStage = new aws.apigatewayv2.Stage(
 'stage',
  {
      apiId: example.id,
      defaultRouteSettings: { loggingLevel: 'ERROR' }
  },
);

When I run pulumi up the first time, it creates things, then the second time, it says there's a difference:

$ pulumi up                                                                                                                                                                                                           
                                                                                                                 
Previewing update (foo):                                                                                                                                                                                              
     Type                       Name          Plan       Info                                                                                                                                                         
     pulumi:pulumi:Stack        aws-2364-foo                                                                                                                                                                          
 ~   └─ aws:apigatewayv2:Stage  stage         update     [diff: ~defaultRouteSettings]                                                                                                                                
                                                                                                                                                                                                                      
                                                                                                                                                                                                                      
Resources:                                                                                                                                                                                                            
    ~ 1 to update                                                                                                                                                                                                     
    2 unchanged                                                                                                                                                                                                       
                                                                                                                                                                                                                      
Do you want to perform this update? details                                                                                                                                                                           
  pulumi:pulumi:Stack: (same)                                                                                                                                                                                         
    [urn=urn:pulumi:foo::aws-2364::pulumi:pulumi:Stack::aws-2364-foo]                                                                                                                                                 
    ~ aws:apigatewayv2/stage:Stage: (update)                                                                                                                                                                          
        [id=stage-0bce1f6]                                                                                                                                                                                            
        [urn=urn:pulumi:foo::aws-2364::aws:apigatewayv2/stage:Stage::stage]                                                                                                                                           
        [provider=urn:pulumi:foo::aws-2364::pulumi:providers:aws::default_5_29_1::0a0aa264-fb15-4450-9f4e-62a0967d56ad]                                                                                               
      ~ defaultRouteSettings: {
          + loggingLevel: "ERROR"
        }

squaremo avatar Feb 14 '23 17:02 squaremo

I ran into this same issue but with the args accessLogSettings.destinationArn.

orballo avatar Dec 22 '23 10:12 orballo

This seems to reproduce upstream https://github.com/hashicorp/terraform-provider-aws/issues/39477 and we inherit the behavior.

t0yv0 avatar Sep 24 '24 22:09 t0yv0

Might not be ideal but can workaround with:

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

const example = new aws.apigatewayv2.Api("example", {
    protocolType: "HTTP",
});

const apiStage = new aws.apigatewayv2.Stage(
 'stage',
  {
      apiId: example.id,
      defaultRouteSettings: { loggingLevel: 'ERROR' }
  },
  {
      ignoreChanges: ["defaultRouteSettings"]
  }
);

t0yv0 avatar Sep 24 '24 22:09 t0yv0