https://pulumi.com logo
#general
Title
# general
h

helpful-ice-5738

02/16/2019, 1:12 AM
I have set up an api through a gaggle of pulumi components. One of them is a usage plan. The usage plan is not associating with my api, but it is set to.
Copy code
const demo_usage_plan = new aws.apigateway.UsagePlan("DemoUsagePlan", {
    apiStages: [
        {
            apiId: demo_api.id,
            stage: demo_deployment.stageName,
        },
    ],
    description: "demo",
the demo_deployment and the demo_api exist. I ran refresh, no changes to UsagePlan (or api or the stage):
Copy code
├─ aws:apigateway:UsagePlan       DemoUsagePlan
I require an API Key. the API key is associated with the usage plan. The usage plan is not associated with an API --> I cannot use my API with an APIKey. I did have a stack working where this was fine. The code hasn’t changed and even if it had, I’d expect pulumi to err at the stageName if it doesn’t exist or something. Any thoughts on what I might have missed or if there’s a bug here?
no_stage.png
s

stocky-spoon-28903

02/16/2019, 5:07 PM
I suspect some of the wait logic in the underlying Terraform provider may be at fault here.
h

helpful-ice-5738

02/19/2019, 5:02 PM
There’s been no indication of failure to create or that any resources haven’t been created — any thoughts here? @gentle-diamond-70147
g

gentle-diamond-70147

02/19/2019, 5:06 PM
Can you share your code or at least a minimum amount that reproduces this? Unfortunately, I'm not that familiar with API Gateway so it will take me awhile to put together an app to test this.
h

helpful-ice-5738

02/19/2019, 5:22 PM
@gentle-diamond-70147 sure — I believe this could demo
you will have to remove the lambda function and integration or include a lambda
g

gentle-diamond-70147

02/19/2019, 5:27 PM
Thanks. Give me a bit to look into this.
h

helpful-ice-5738

02/19/2019, 5:39 PM
now I am having an issue with deleting the stack —
Copy code
Usage Plan: NotFoundException: Invalid API Stage...
ah @gentle-diamond-70147 looks like when I created the deployment the stage was already created - not sure how that got the last stack in a state where both were successfully created but not associated, but removing the stage creation works 😕
Lambda invocation remains an issue though 😕 This is something on AWS’s side because it’s consistently bad. To fix lambda invocation, the easiest work around is to go into the API gateway UI, edit the integration by: (API/<api_name>/Resources then click on the method, click on the
integration request
, and then click the pencil next to
lambda function
and just save — creates a popup to allow invocation
g

gentle-diamond-70147

02/19/2019, 6:02 PM
just so I'm following, that's an issue with
aws.apigateway.Integration
in your code, right? That gets saved, but not "enabled" - is that the issue?
h

helpful-ice-5738

02/19/2019, 6:04 PM
the lambda invocation issue?
yes!
g

gentle-diamond-70147

02/19/2019, 6:04 PM
yes
h

helpful-ice-5738

02/19/2019, 6:04 PM
exactly
g

gentle-diamond-70147

02/19/2019, 6:05 PM
after clicking Save in the AWS console, if you do a
pulumi refresh
does it show any updated resources/attributes?
h

helpful-ice-5738

02/19/2019, 6:07 PM
yes
g

gentle-diamond-70147

02/19/2019, 6:08 PM
which resources/attributes show changes during the refresh after a save?
h

helpful-ice-5738

02/19/2019, 6:08 PM
Copy code
pulumi:pulumi:Stack               pulumi_demo-pulumi_demo              
     ├─ aws:iam:Policy                 DemoLogCreationPolicy                
 ~   ├─ aws:iam:Role                   DemoIamApiRole            update     [diff: ~assumeRolePolicy]
     ├─ aws:apigateway:ApiKey          DemoApiKey                           
     ├─ aws:apigateway:RestApi         DemoApi                              
     ├─ aws:apigateway:Account         DemoApiAccount                       
     ├─ aws:s3:Bucket                  DemoBucket                           
     ├─ aws:dynamodb:Table             DemoTable                            
     ├─ aws:iam:RolePolicyAttachment   DemoApiRolePolicy                    
     ├─ aws:iam:RolePolicyAttachment   DemoRolePolicyAttachment             
 ~   ├─ aws:s3:BucketPolicy            DemoBucketPolicy          update     [diff: ~policy]
     ├─ aws:apigateway:Resource        DemoResource                         
 ~   ├─ aws:apigateway:Method          DemoMethodPost            update     [diff: +authorizationScopes,authorizerId,requestModels,requestParameters,requestValidatorId]
     ├─ aws:s3:BucketObject            DemoBucketObject                     
 ~   ├─ aws:iam:Role                   DemoIamRole               update     [diff: ~assumeRolePolicy]
     ├─ aws:iam:RolePolicy             DemoInvocationPolicy                 
     ├─ aws:apigateway:Integration     DemoGetIntegration                   
 ~   ├─ aws:apigateway:Method          DemoMethodGet             update     [diff: +authorizationScopes,authorizerId,requestModels,requestParameters,requestValidatorId]
     ├─ aws:apigateway:UsagePlanKey    DemoUsagePlanKey                     
     ├─ aws:apigateway:Deployment      DemoDeployment                       
 ~   ├─ aws:apigateway:Integration     DemoPostIntegration       update     [diff: ~contentHandling]
     ├─ aws:apigateway:MethodSettings  DemoGetMethodSettings                
     ├─ aws:apigateway:UsagePlan       DemoUsagePlan                        
     ├─ aws:apigateway:MethodSettings  DemoPostMethodSettings               
 ~   └─ aws:lambda:Function            PythonFunction
if I do the same UI click with the
get
method (I initially had just done so for
post
)
Copy code
Type                              Name                      Plan       Info
     pulumi:pulumi:Stack               pulumi_demo-pulumi_demo              
     ├─ aws:apigateway:ApiKey          DemoApiKey                           
     ├─ aws:iam:Policy                 DemoLogCreationPolicy                
     ├─ aws:apigateway:RestApi         DemoApi                              
 ~   ├─ aws:iam:Role                   DemoIamApiRole            update     [diff: ~assumeRolePolicy]
     ├─ aws:iam:Role                   DemoIamRole                          
     ├─ aws:iam:RolePolicyAttachment   DemoApiRolePolicy                    
     ├─ aws:apigateway:Resource        DemoResource                         
     ├─ aws:apigateway:Account         DemoApiAccount                       
     ├─ aws:dynamodb:Table             DemoTable                            
 ~   ├─ aws:s3:BucketPolicy            DemoBucketPolicy          update     [diff: ~policy]
 ~   ├─ aws:apigateway:Method          DemoMethodPost            update     [diff: +authorizationScopes,authorizerId,requestModels,requestParameters,requestValidatorId]
     ├─ aws:iam:RolePolicyAttachment   DemoRolePolicyAttachment             
     ├─ aws:s3:Bucket                  DemoBucket                           
 ~   ├─ aws:apigateway:Method          DemoMethodGet             update     [diff: +authorizationScopes,authorizerId,requestModels,requestParameters,requestValidatorId]
     ├─ aws:s3:BucketObject            DemoBucketObject                     
     ├─ aws:iam:RolePolicy             DemoInvocationPolicy                 
     ├─ aws:apigateway:Deployment      DemoDeployment                       
     ├─ aws:apigateway:UsagePlanKey    DemoUsagePlanKey                     
 ~   ├─ aws:apigateway:Integration     DemoGetIntegration        update     [diff: ~contentHandling,integrationHttpMethod]
 ~   ├─ aws:apigateway:Integration     DemoPostIntegration       update     [diff: ~contentHandling]
     ├─ aws:apigateway:MethodSettings  DemoGetMethodSettings                
     ├─ aws:apigateway:UsagePlan       DemoUsagePlan                        
 ~   ├─ aws:lambda:Function            PythonFunction            
     └─ aws:apigateway:MethodSettings  DemoPostMethodSettings
g

gentle-diamond-70147

02/19/2019, 6:14 PM
I think this will take more digging into than I'm able to do right this moment. Could you open an issue at https://github.com/pulumi/pulumi-aws/issues ?
h

helpful-ice-5738

02/19/2019, 6:15 PM
Yeah 🙂 thanks for checkin it out
g

gentle-diamond-70147

02/19/2019, 6:22 PM
Thank you for your patience!
2 Views