You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have facing one issue. Whenever I am trying to add a file in S3 in the same .tf file, the error comes that S3 bucket doesnt exist. However If I apply the below tf file again, it works.
So my requirement is that the below file should work such that it creates the bucket and so also add the file in the same bucket. RIght now its not doing it for the first time have to re apply to insert the file.'
In order for terraform to know that the bucket must be created before the object, you must somehow reference the bucket from that object. For example, your resource might look like
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.
ghost
locked and limited conversation to collaborators
Jul 25, 2019
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello Team,
I have facing one issue. Whenever I am trying to add a file in S3 in the same .tf file, the error comes that S3 bucket doesnt exist. However If I apply the below tf file again, it works.
So my requirement is that the below file should work such that it creates the bucket and so also add the file in the same bucket. RIght now its not doing it for the first time have to re apply to insert the file.'
Below is the file:
#1. Populating account details
provider "aws" {
access_key = "XXXXXXXXX"
secret_key = "XXXXXXXXX"
region = "us-east-1"
}
#2. CReation of Bucket "shubhasisterraform"
resource "aws_s3_bucket" "b" {
bucket = "shubhasisterraform"
acl = "private"
tags {
Name = "My bucket"
Environment = "Dev"
}
}
#3. adding of file accountdetails in S3 bucket(shubhasisterraform)
resource "aws_s3_bucket_object" "bucket" {
bucket = "shubhasisterraform"
key = "new_object_key"
source = "/root/S3/accountdetails"
etag = "${md5(file("/root/S3/accountdetails"))}"
}
The text was updated successfully, but these errors were encountered: