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

Use aws_s3_object instead of aws_s3_bucket_object #821

Merged
merged 2 commits into from
Jun 12, 2024

Conversation

gjclark
Copy link
Contributor

@gjclark gjclark commented Jun 11, 2024

Closes #801

@gjclark gjclark changed the title refactor: use aws_s3_object instead of aws_s3_bucket_object Use aws_s3_object instead of aws_s3_bucket_object Jun 11, 2024
@gjclark gjclark marked this pull request as ready for review June 11, 2024 22:03
Copy link
Contributor

@reweeden reweeden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it would be a good idea to add a required_providers block to the terraform module so we can pin the minimum supported version of the AWS provider. I'm actually a little surprised that it works without that.

@gjclark
Copy link
Contributor Author

gjclark commented Jun 12, 2024

I wonder if it would be a good idea to add a required_providers block to the terraform module so we can pin the minimum supported version of the AWS provider. I'm actually a little surprised that it works without that.

NISAR has:

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"
    }
    null = {
      source  = "hashicorp/null"
      version = "~> 2.1"
    }
  }
}

Should I just duplicate that here?

Well, actually, I cut out a couple things that were in https://github.com/asfadmin/CIRRUS-NISAR/blob/master/workflows/nisar/provider.tf.

@reweeden
Copy link
Contributor

You should only include the providers that the module actually needs and you should use >= as explained on the best practices section here: https://developer.hashicorp.com/terraform/language/providers/requirements#best-practices-for-provider-versions

@gjclark gjclark requested a review from reweeden June 12, 2024 20:33
@@ -11,7 +11,6 @@

# Tools
.terraform
/terraform/providers.tf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol, why was that in there?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah I don't know. I was hoping to find some discussion in the PR that brought that in. Couldn't find the reason.

version = ">= 5.0"
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing newline

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't the minimum. I just checked a random 4.x version and 4.63 has the aws_s3_object already. So you can go down at least to that.

You should find the lowest version that has that resource. I would do it through trial and error using this page and selecting the version from the version dropdown:
https://registry.terraform.io/providers/hashicorp/aws/4.63.0/docs/resources/s3_bucket_object

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like 4.0 introduced it.

@gjclark gjclark force-pushed the gjc/refactor/aws_s3_object branch from 6125c91 to d0c2d3c Compare June 12, 2024 22:31
@gjclark gjclark requested a review from reweeden June 12, 2024 22:58
@gjclark gjclark merged commit 977b429 into devel Jun 12, 2024
9 of 10 checks passed
@gjclark gjclark deleted the gjc/refactor/aws_s3_object branch June 12, 2024 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

update Terraform code to prevent Deprecated Resource warnings
4 participants