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

salmon-army-25804

04/09/2020, 7:04 PM
Hi there 👋 I'm trying to use pulumi to codify a static website redirect in aws s3 (section "Redirecting Requests for a Bucket's Website Endpoint to Another Host" in https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html). In pulumi, I'm creating a
new aws.s3.Bucket
with param
website: { redirectAllRequestsTo: "<http://example.com|example.com>" }
. The s3 docs say that there is an option to specify protocol (I need to redirect with
https
) but that does not seem possible in pulumi since
redirectAllRequestsTo
is of type
pulumi.Input<string>
. I additionally tried to specify
routingRules: { Redirect: {HostName: "<http://example.com|example.com>",Protocol: "https"} }
to the same Bucket resource but then get the error message that
aws:s3/bucket:Bucket resource 'mybucketname' has a problem: "website.0.redirect_all_requests_to": conflicts with website.0.routing_rules
. Additionally, if I go into the AWS web UI and manually update the Protocol field to "https" and then run
pulumi up
, pulumi does not recognize that a change was made to the bucket configs which leads me to wonder if there is a bug
would really appreciate any guidance and apologies if I'm doing something silly!
also, if i only specify
routingRules
but not
redirectAllRequestsTo
, then i get
Must specify either index_document or redirect_all_requests_to.
upon executing
pulumi up
😕
b

busy-umbrella-36067

04/09/2020, 9:04 PM
try running
pulumi refresh
after changing the value in the Web UI
s

salmon-army-25804

04/10/2020, 1:43 AM
that worked, thanks! is there anyway to handle this completely within pulumi?
im nervous about changing anything in the web UI because it could be a source of inconsistencies between staging/prod
b

busy-umbrella-36067

04/10/2020, 1:46 AM
I would look at the detailed diff and see what values changed
try to match the interfaces
if you look at some of the examples it looks like they treat the JSON object as a string https://www.pulumi.com/docs/reference/pkg/aws/s3/bucket/#static-website-hosting
s

salmon-army-25804

04/10/2020, 4:25 PM
okay gotcha, thanks! btw, i was wondering if there's continued investment on import. we found it super useful for migrating our infrastructure to code, and would be excited about a way to specify an arn and have pulumi output the inputs it expects. was wondering what you think? also lmk if i missed it or if it doesnt make sense 😛
b

busy-umbrella-36067

04/10/2020, 7:46 PM
I think if you try to import a resource that doesn’t match the spec you wrote pulumi will error and provide you with the diff
it doesn’t necessarily write the code for you, but it will at least tell you what needs to change before the resource can be imported into state
s

salmon-army-25804

04/10/2020, 9:31 PM
oh let me look into it more next time! i remember seeing which fields were different, but not the expansion of those fields...thanks for clarifying 🙂
3 Views