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

pricing for remote state files #3

Closed
hemzet opened this issue Jun 29, 2021 · 4 comments
Closed

pricing for remote state files #3

hemzet opened this issue Jun 29, 2021 · 4 comments

Comments

@hemzet
Copy link

hemzet commented Jun 29, 2021

Hi,
Can you provide an example of how to work with remote state files for the pricing module, please?
The remote state files need credentials so cannot be accessed simply via aws_s3_bucket_object. And as the S3 bucket is private, data http requests fail as well.
Any recommendation on how to deal with this scenario is much appreciated.
Thank you

@hemzet hemzet changed the title working with remote states pricing for remote stat Jun 29, 2021
@hemzet hemzet changed the title pricing for remote stat pricing for remote state files Jun 29, 2021
@antonbabenko
Copy link
Member

Hi! You should copy it from the remote state location and then pass it as an argument to this module (see this example).

Here is how you can do this using curl from Terraform - https://github.com/terraform-aws-modules/terraform-aws-s3-bucket/blob/master/examples/notification/main.tf#L16-L33

@alko89
Copy link

alko89 commented Aug 18, 2021

This is really not a good way of doing it IMO. This means you have to download the state before the price, which means you have to do in two terraform modules. One to download the state and another to get the price. It would be a huge improvement to be able to do this in one go.

I tried using http module, but seems to not work as expected:

data "http" "example" {
  url = local.state_url

  request_headers = {
    Accept = "application/json"
    Authorization = "Basic ${local.base_auth}"
  }
}

module "pricing" {
  source = "terraform-aws-modules/pricing/aws//modules/pricing"

  aws_default_region = var.region

  content = data.http.example.body
}

However for some reason this doesn't work:
Invalid value for "inputMap" parameter: must have map or object type. I also tried encoding json body, but no luck.

@antonbabenko
Copy link
Member

@alko89 This is partially related to this open issue - hashicorp/terraform#4149 . Unfortunately, there is no easy solution that I am aware of.

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants