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

New Resource: aws_ecrpublic_repository #16865

Merged
merged 33 commits into from
Feb 24, 2021
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3b4626e
schema and create function
breathingdust Dec 20, 2020
dc7d378
most of read, few questions
breathingdust Dec 20, 2020
ed3115e
add computed fields
breathingdust Dec 20, 2020
f3c5670
add deletefunc
breathingdust Dec 20, 2020
2bbbcd6
UpdateFunc
breathingdust Dec 20, 2020
66860a9
add basic test
breathingdust Dec 21, 2020
ca0f9e0
tests passing without catalog_data block
breathingdust Dec 21, 2020
21f7ba0
basic test passing
breathingdust Dec 21, 2020
93aa7db
add disappears test
breathingdust Dec 21, 2020
46de2a6
all catalog block tests except for logo
breathingdust Dec 21, 2020
b7dc263
failing logo test
breathingdust Dec 21, 2020
aaa0a47
fix file encoding
breathingdust Dec 21, 2020
24cf563
fix acc test linting errors
breathingdust Dec 21, 2020
e114cac
added documentation
breathingdust Dec 22, 2020
bed44aa
fix formatting
breathingdust Dec 22, 2020
62a2a15
website lint fixes
breathingdust Dec 22, 2020
19f12a3
import naming fix
breathingdust Dec 22, 2020
0aaa6e5
add an error check to logo blob read
breathingdust Dec 23, 2020
cdcf277
get partition from helper
breathingdust Dec 23, 2020
e29138b
revert debug line
breathingdust Dec 23, 2020
9e55e82
add custom precheck
breathingdust Feb 17, 2021
4313830
rename repository_arn to arn
breathingdust Feb 17, 2021
3290854
nil check AWS SDK output
breathingdust Feb 17, 2021
8d71e19
use type conversion function
breathingdust Feb 17, 2021
c009e4e
change architecture + operatingsystem to TypeSet
breathingdust Feb 17, 2021
be701b2
modify force_destroy handling
breathingdust Feb 17, 2021
77f9489
add update test steps for attributes
breathingdust Feb 17, 2021
2dea23b
correct %q usage
breathingdust Feb 17, 2021
b5af6ed
add id attribute documentation
breathingdust Feb 17, 2021
f5cf291
remove drift detection for logo attribute
breathingdust Feb 17, 2021
6278495
add special handling for computer logo_image_blob attribute
breathingdust Feb 23, 2021
9eed993
add changelog
breathingdust Feb 24, 2021
7c9d19a
fix import documentation
breathingdust Feb 24, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add an error check to logo blob read
breathingdust committed Dec 23, 2020
commit 0aaa6e54c421db913ef7895fefddb9a7a80783c8
12 changes: 12 additions & 0 deletions aws/resource_aws_ecrpublic_repository.go
Original file line number Diff line number Diff line change
@@ -3,7 +3,9 @@ package aws
import (
"encoding/base64"
"fmt"
"io/ioutil"
"log"
"net/http"
"regexp"
"time"

@@ -274,6 +276,16 @@ func flattenEcrPublicRepositoryCatalogData(apiObject *ecrpublic.GetRepositoryCat

if v := catalogData.LogoUrl; v != nil {
tfMap["logo_image_url"] = aws.StringValue(v)

resp, err := http.Get(aws.StringValue(v))
Copy link
Contributor

Choose a reason for hiding this comment

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

There are quite a few considerations that must be taken into account when creating a custom HTTP client (such as respecting HTTP proxies and other restrictions in certain environments), which is why we typically discourage the practice. It might be best to document that we do not support drift detection for this attribute and remove this or provide a method for opting out for environments that might have trouble with this.


if err != nil {
log.Printf("[ERROR] unable to read logo image contents: %s", err)
}

defer resp.Body.Close()
imageData, _ := ioutil.ReadAll(resp.Body)
tfMap["logo_image_blob"] = base64.StdEncoding.EncodeToString(imageData)
}

if v := catalogData.OperatingSystems; v != nil {